mirror of
				https://github.com/vform666/variant-form3-vite.git
				synced 2025-10-31 16:51:49 +08:00 
			
		
		
		
	修复清空设计器画布时未同步清除组件refList的错误。
This commit is contained in:
		| @@ -92,6 +92,7 @@ export function createDesigner(vueInstance) { | ||||
|       let modifiedFlag = false | ||||
|  | ||||
|       if (!!formJson && !!formJson.widgetList) { | ||||
|         this.formWidget.clearWidgetRefList() | ||||
|         this.widgetList = formJson.widgetList | ||||
|         modifiedFlag = true | ||||
|       } | ||||
|   | ||||
| @@ -68,6 +68,7 @@ export default { | ||||
|  | ||||
|     removeWidget() { | ||||
|       if (!!this.parentList) { | ||||
|         const widgetRefName = this.designer.selectedWidgetName | ||||
|         let nextSelected = null | ||||
|         if (this.parentList.length === 1) { | ||||
|           if (!!this.parentWidget) { | ||||
| @@ -81,10 +82,9 @@ export default { | ||||
|  | ||||
|         this.$nextTick(() => { | ||||
|           this.parentList.splice(this.indexOfParentList, 1) | ||||
|           //if (!!nextSelected) { | ||||
|           this.designer.setSelected(nextSelected) | ||||
|           //} | ||||
|  | ||||
|           this.designer.formWidget.deleteWidgetRef(widgetRefName)  //删除组件ref!!! | ||||
|           this.designer.emitHistoryChange() | ||||
|         }) | ||||
|       } | ||||
|   | ||||
| @@ -188,6 +188,7 @@ | ||||
|  | ||||
|       removeFieldWidget() { | ||||
|         if (!!this.parentList) { | ||||
|           const fieldRefName = this.designer.selectedWidgetName | ||||
|           let nextSelected = null | ||||
|           if (this.parentList.length === 1) { | ||||
|             if (!!this.parentWidget) { | ||||
| @@ -201,10 +202,9 @@ | ||||
|  | ||||
|           this.$nextTick(() => { | ||||
|             this.parentList.splice(this.indexOfParentList, 1) | ||||
|             //if (!!nextSelected) { | ||||
|             this.designer.setSelected(nextSelected) | ||||
|             //} | ||||
|  | ||||
|             this.designer.formWidget.deleteWidgetRef(fieldRefName)  //删除组件ref!!! | ||||
|             this.designer.emitHistoryChange() | ||||
|           }) | ||||
|         } | ||||
|   | ||||
| @@ -107,6 +107,7 @@ | ||||
|  | ||||
|       removeFieldWidget() { | ||||
|         if (!!this.parentList) { | ||||
|           const fieldRefName = this.designer.selectedWidgetName | ||||
|           let nextSelected = null | ||||
|           if (this.parentList.length === 1) { | ||||
|             if (!!this.parentWidget) { | ||||
| @@ -120,10 +121,9 @@ | ||||
|  | ||||
|           this.$nextTick(() => { | ||||
|             this.parentList.splice(this.indexOfParentList, 1) | ||||
|             //if (!!nextSelected) { | ||||
|             this.designer.setSelected(nextSelected) | ||||
|             //} | ||||
|  | ||||
|             this.designer.formWidget.deleteWidgetRef(fieldRefName)  //删除组件ref!!! | ||||
|             this.designer.emitHistoryChange() | ||||
|           }) | ||||
|         } | ||||
|   | ||||
| @@ -184,6 +184,10 @@ | ||||
|         }) | ||||
|       }, | ||||
|  | ||||
|       deleteWidgetRef(widgetRefName) { | ||||
|         delete this.widgetRefList[widgetRefName] | ||||
|       }, | ||||
|  | ||||
|     } | ||||
|   } | ||||
| </script> | ||||
|   | ||||
| @@ -290,7 +290,6 @@ | ||||
|           } | ||||
|  | ||||
|           if (modifiedFlag) { | ||||
|             this.$refs.formRef.clearWidgetRefList() | ||||
|             this.designer.emitHistoryChange() | ||||
|           } | ||||
|         } | ||||
| @@ -305,7 +304,6 @@ | ||||
|  | ||||
|       clearDesigner() { | ||||
|         this.$refs.toolbarRef.clearFormWidget() | ||||
|         this.$refs.formRef.clearWidgetRefList() | ||||
|       }, | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -444,6 +444,7 @@ | ||||
|  | ||||
|       clearFormWidget() { | ||||
|         this.designer.clearDesigner() | ||||
|         this.designer.formWidget.clearWidgetRefList() | ||||
|       }, | ||||
|  | ||||
|       previewForm() { | ||||
|   | ||||
| @@ -352,7 +352,7 @@ export function getDefaultFormConfig() { | ||||
|     size: '', | ||||
|     labelAlign: 'label-left-align', | ||||
|     cssCode: '', | ||||
|     customClass: '', | ||||
|     customClass: [], | ||||
|     functions: '',  //全局函数 | ||||
|     layoutType: 'PC', | ||||
|     jsonVersion: 3, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user