|
|
|
@ -1,10 +1,15 @@ |
|
|
|
<script setup lang="ts"> |
|
|
|
import { reactive } from "vue"; |
|
|
|
import { createVNode, getCurrentInstance, reactive, toRaw } from "vue"; |
|
|
|
import { Format } from "@ease-forge/shared"; |
|
|
|
import { createBlockComponent } from "@ease-forge/runtime"; |
|
|
|
import DataForm, { type DataFormProps } from "@/components/data-form/DataForm.vue"; |
|
|
|
|
|
|
|
const dataForm1 = reactive<DataFormProps>({ |
|
|
|
data: { |
|
|
|
window.globalConfig.componentManage.registerComponent("DataForm", DataForm); |
|
|
|
|
|
|
|
// 当前组件对象 |
|
|
|
const instance = getCurrentInstance(); |
|
|
|
|
|
|
|
const data = reactive({ |
|
|
|
str: "abcABC", |
|
|
|
num_1: 123, |
|
|
|
checkbox_1: true, |
|
|
|
@ -58,7 +63,9 @@ const dataForm1 = reactive<DataFormProps>({ |
|
|
|
"福满人间", |
|
|
|
"属性适用于 textarea 节点,并且只有高度会自动变化。另外 autoSize 可以设定为一个对象,指定最小行数和最大行数" |
|
|
|
].join("\n"), |
|
|
|
}, |
|
|
|
}); |
|
|
|
|
|
|
|
const dataForm1 = reactive<DataFormProps>({ |
|
|
|
formFields: [ |
|
|
|
{ |
|
|
|
dataPath: 'str', label: '字符串', input: 'Input', |
|
|
|
@ -358,22 +365,70 @@ const dataForm1 = reactive<DataFormProps>({ |
|
|
|
layout: "onlyLabelFixed", |
|
|
|
}); |
|
|
|
|
|
|
|
const MyDataForm = createBlockComponent({ |
|
|
|
block: true, |
|
|
|
type: "DataForm", |
|
|
|
data: { |
|
|
|
data: toRaw(data), |
|
|
|
}, |
|
|
|
props: { |
|
|
|
style: { |
|
|
|
overflowY: "auto", |
|
|
|
}, |
|
|
|
// data: "{{ data }}", |
|
|
|
data: toRaw(data), |
|
|
|
formFields: dataForm1.formFields, |
|
|
|
columnCount: dataForm1.columnCount, |
|
|
|
layout: dataForm1.layout, |
|
|
|
labelWidth: "100px", |
|
|
|
}, |
|
|
|
}, { |
|
|
|
componentManage: window.globalConfig.componentManage, |
|
|
|
}); |
|
|
|
|
|
|
|
function test() { |
|
|
|
system.showDialog(createVNode(DataForm, { |
|
|
|
style: { |
|
|
|
overflowY: "auto", |
|
|
|
}, |
|
|
|
data: toRaw(data), |
|
|
|
formFields: dataForm1.formFields, |
|
|
|
columnCount: dataForm1.columnCount, |
|
|
|
layout: dataForm1.layout, |
|
|
|
labelWidth: "100px", |
|
|
|
}), { |
|
|
|
title: '模型查看器', |
|
|
|
width: 950, |
|
|
|
height: 400, |
|
|
|
showClose: true, |
|
|
|
showMax: true, |
|
|
|
showCancelButton: false, |
|
|
|
showOkButton: true, |
|
|
|
}).then(() => { |
|
|
|
console.log("data", data); |
|
|
|
// instance?.proxy.$forceUpdate(); |
|
|
|
}).finally(); |
|
|
|
} |
|
|
|
|
|
|
|
</script> |
|
|
|
|
|
|
|
<template> |
|
|
|
<div> |
|
|
|
<button @click="test">测试</button> |
|
|
|
</div> |
|
|
|
<div class="flex-row-container" style="column-gap: 12px;height: calc(100% - 30px);"> |
|
|
|
<DataForm |
|
|
|
class="flex-item-fixed" |
|
|
|
style="width: 900px;height: 100%; overflow-y: auto;border: 1px solid #ccc;padding: 6px" |
|
|
|
:data="dataForm1.data" |
|
|
|
:data="data" |
|
|
|
:formFields="dataForm1.formFields" |
|
|
|
:columnCount="dataForm1.columnCount" |
|
|
|
:layout="dataForm1.layout" |
|
|
|
labelWidth="100px" |
|
|
|
inputWidth="" |
|
|
|
:colon="true" |
|
|
|
/> |
|
|
|
<pre class="flex-item-fill" style="overflow-y: auto;" lang="json">{{ JSON.stringify(dataForm1.data, null, 4) }}</pre> |
|
|
|
<!--<MyDataForm class="flex-item-fixed" style="width: 900px;height: 100%; overflow-y: auto;border: 1px solid #ccc;padding: 6px"/>--> |
|
|
|
<pre class="flex-item-fill" style="overflow-y: auto;" lang="json">{{ JSON.stringify(data, null, 4) }}</pre> |
|
|
|
</div> |
|
|
|
<div style="height: 24px;"/> |
|
|
|
</template> |
|
|
|
|