修复清空设计器画布时未同步清除组件refList的错误。

master
vdpAdmin 2023-02-20 15:51:27 +08:00
parent 299e7c7506
commit 52b3b33043
8 changed files with 13 additions and 9 deletions

View File

@ -92,6 +92,7 @@ export function createDesigner(vueInstance) {
let modifiedFlag = false
if (!!formJson && !!formJson.widgetList) {
this.formWidget.clearWidgetRefList()
this.widgetList = formJson.widgetList
modifiedFlag = true
}

View File

@ -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()
})
}

View File

@ -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()
})
}

View File

@ -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()
})
}

View File

@ -184,6 +184,10 @@
})
},
deleteWidgetRef(widgetRefName) {
delete this.widgetRefList[widgetRefName]
},
}
}
</script>

View File

@ -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()
},

View File

@ -444,6 +444,7 @@
clearFormWidget() {
this.designer.clearDesigner()
this.designer.formWidget.clearWidgetRefList()
},
previewForm() {

View File

@ -352,7 +352,7 @@ export function getDefaultFormConfig() {
size: '',
labelAlign: 'label-left-align',
cssCode: '',
customClass: '',
customClass: [],
functions: '', //全局函数
layoutType: 'PC',
jsonVersion: 3,