From fba05b946d866c3d10065c8ce13f41e63b621868 Mon Sep 17 00:00:00 2001 From: vdpAdmin Date: Tue, 12 Apr 2022 18:20:15 +0800 Subject: [PATCH] =?UTF-8?q?v-form-designer=E6=96=B0=E5=A2=9E=E4=B8=A4?= =?UTF-8?q?=E4=B8=AAAPI=E6=96=B9=E6=B3=95=EF=BC=9AgetWidgetRef=E3=80=81get?= =?UTF-8?q?SelectedWidgetRef=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/form-designer/designer.js | 6 +++--- .../container-widget/grid-col-widget.vue | 7 ++++--- .../container-widget/grid-widget.vue | 7 ++++++- .../container-widget/tab-widget.vue | 10 +++++---- .../container-widget/table-cell-widget.vue | 9 +++++--- .../container-widget/table-widget.vue | 7 ++++++- .../field-widget/select-widget.vue | 2 +- .../form-designer/form-widget/index.vue | 7 ++++++- src/components/form-designer/index.vue | 21 +++++++++++++++++++ .../property-editor/name-editor.vue | 21 +++++++++++-------- .../container-item/grid-col-item.vue | 3 ++- .../container-item/table-cell-item.vue | 3 ++- src/extension/samples/card/card-widget.vue | 9 +++++--- src/lang/en-US.js | 6 +++--- 14 files changed, 84 insertions(+), 34 deletions(-) diff --git a/src/components/form-designer/designer.js b/src/components/form-designer/designer.js index e9d6f3f..8fa87f5 100644 --- a/src/components/form-designer/designer.js +++ b/src/components/form-designer/designer.js @@ -100,7 +100,8 @@ export function createDesigner(vueInstance) { getImportTemplate() { return { widgetList: [], - formConfig: deepClone(this.formConfig) + // formConfig: deepClone(this.formConfig) + formConfig: deepClone(defaultFormConfig) } }, @@ -133,9 +134,8 @@ export function createDesigner(vueInstance) { } }, - updateSelectedWidgetNameAndRef(selectedWidget, newName, newLabel) { + updateSelectedWidgetNameAndLabel(selectedWidget, newName, newLabel) { this.selectedWidgetName = newName - //selectedWidget.options.name = newName //此行多余 if (!!newLabel && (Object.keys(selectedWidget.options).indexOf('label') > -1)) { selectedWidget.options.label = newLabel } diff --git a/src/components/form-designer/form-widget/container-widget/grid-col-widget.vue b/src/components/form-designer/form-widget/container-widget/grid-col-widget.vue index f49f7dc..2b29c6a 100644 --- a/src/components/form-designer/form-widget/container-widget/grid-col-widget.vue +++ b/src/components/form-designer/form-widget/container-widget/grid-col-widget.vue @@ -43,16 +43,16 @@ diff --git a/src/components/form-designer/index.vue b/src/components/form-designer/index.vue index 1ef0274..3047586 100644 --- a/src/components/form-designer/index.vue +++ b/src/components/form-designer/index.vue @@ -107,12 +107,15 @@ externalLink: true, //是否显示GitHub、文档等外部链接 formTemplates: true, //是否显示表单模板 eventCollapse: true, //是否显示组件事件属性折叠面板 + widgetNameReadonly: false, //禁止修改组件名称 + clearDesignerButton: true, //是否显示清空设计器按钮 previewFormButton: true, //是否显示预览表单按钮 importJsonButton: true, //是否显示导入JSON按钮 exportJsonButton: true, //是否显示导出JSON器按钮 exportCodeButton: true, //是否显示导出代码按钮 generateSFCButton: true, //是否显示生成SFC按钮 + toolbarMaxWidth: 420, //设计器工具按钮栏最大宽度(单位像素) toolbarMinWidth: 300, //设计器工具按钮栏最小宽度(单位像素) @@ -361,6 +364,14 @@ return !!widgetList ? getAllContainerWidgets(widgetList) : getAllContainerWidgets(this.designer.widgetList) }, + getWidgetRef(widgetName, showError = false) { + return this.$refs['formRef'].getWidgetRef(widgetName, showError) + }, + + getSelectedWidgetRef() { + return this.$refs['formRef'].getSelectedWidgetRef() + }, + //TODO: 增加更多方法!! } @@ -368,6 +379,16 @@