From 539f2610fc2c21f16e258fe5faf0dff182d5c632 Mon Sep 17 00:00:00 2001 From: lizw-2015 <1183409807@qq.com> Date: Fri, 6 Jun 2025 17:46:30 +0800 Subject: [PATCH] =?UTF-8?q?refactor(property):=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=E9=9D=A2=E6=9D=BF=E5=B9=B6=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=AE=9E=E6=97=B6=E7=BC=96=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修改 DataForm 组件的 valuesChange 事件为 dataChange - 在 PropertyPanel 中添加实时编辑功能,通过 viewport 更新状态 - 优化 PropertyPanel 的数据处理和组件渲染 - 调整 PropertyPanelConstant 中的默认属性值 --- src/components/data-form/DataForm.vue | 8 ++++-- src/editor/widgets/property/PropertyPanel.vue | 29 +++++++++++++++++++--- .../widgets/property/PropertyPanelConstant.ts | 4 +-- src/editor/widgets/property/PropertyView.vue | 2 ++ 4 files changed, 36 insertions(+), 7 deletions(-) diff --git a/src/components/data-form/DataForm.vue b/src/components/data-form/DataForm.vue index bb2a871..96d01b3 100644 --- a/src/components/data-form/DataForm.vue +++ b/src/components/data-form/DataForm.vue @@ -22,7 +22,7 @@ const emit = defineEmits<{ /** 表单字段变化 */ // fieldsChange: [changedFields: Array, allFields: Array]; /** 表单值变化 */ - valuesChange: [changedValues: any, values: any]; + dataChange: [newData: any]; }>(); // 定义组件插槽 @@ -73,7 +73,11 @@ if (Typeof.isObj(props.columnCount)) { // 加载数据 if (props.autoLoadData && props.dataApi) reload().finally(); // 监听data -watch(() => state.data, newData => dataChange(state.dataFormItems, newData), { immediate: true, deep: true }); +watch(() => state.data, newData => { + const firstDataChange = data.firstDataChange; + dataChange(state.dataFormItems, newData); + if (!firstDataChange) emit("dataChange", newData); +}, { immediate: true, deep: true }); // 监听loading watch(() => state.loading, loading => emit("loadingChange", loading)); // 设置ctxData(表单上下文数据) diff --git a/src/editor/widgets/property/PropertyPanel.vue b/src/editor/widgets/property/PropertyPanel.vue index eec5d11..8c02748 100644 --- a/src/editor/widgets/property/PropertyPanel.vue +++ b/src/editor/widgets/property/PropertyPanel.vue @@ -1,10 +1,12 @@