From 8cfee501fe16782fec705427dc8ac17b21fd3227 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Tue, 20 Dec 2022 15:24:42 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E4=BB=AA=E8=A1=A8=E6=9D=BF):=20=E5=88=A0?= =?UTF-8?q?=E9=99=A4Tab=E7=94=BB=E5=B8=83=E6=97=B6=E5=90=8C=E6=97=B6?= =?UTF-8?q?=E6=B8=85=E7=90=86=E5=AF=B9=E5=BA=94=E7=94=BB=E5=B8=83=E7=9A=84?= =?UTF-8?q?=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/widget/deWidget/DeTabs.vue | 2 +- frontend/src/store/index.js | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/widget/deWidget/DeTabs.vue b/frontend/src/components/widget/deWidget/DeTabs.vue index fa9c821dfc..23c51cb41c 100644 --- a/frontend/src/components/widget/deWidget/DeTabs.vue +++ b/frontend/src/components/widget/deWidget/DeTabs.vue @@ -640,7 +640,7 @@ export default { while (len--) { if (this.element.options.tabList[len].name === param.name) { this.element.options.tabList.splice(len, 1) - + this.$store.commit('deleteComponentsWithCanvasId', this.element.id + '-' + param.name) const activeIndex = (len - 1 + this.element.options.tabList.length) % this.element.options.tabList.length this.activeTabName = this.element.options.tabList[activeIndex].name } diff --git a/frontend/src/store/index.js b/frontend/src/store/index.js index fda7afc92e..a6f76f0cda 100644 --- a/frontend/src/store/index.js +++ b/frontend/src/store/index.js @@ -503,6 +503,9 @@ const data = { const element = state.componentData[index] if (element.id && element.id === id) { state.componentData.splice(index, 1) + if (element.type === 'de-tabs') { + this.commit('deleteComponentsWithCanvasId', element.id) + } break } } @@ -811,6 +814,16 @@ const data = { state.mousePointShadowMap.mouseY = mousePoint.mouseY state.mousePointShadowMap.width = mousePoint.width state.mousePointShadowMap.height = mousePoint.height + }, + deleteComponentsWithCanvasId(state, canvasId) { + if (canvasId && canvasId.length > 10) { + for (let index = 0; index < state.componentData.length; index++) { + const element = state.componentData[index] + if (element.canvasId && element.canvasId.includes(canvasId)) { + state.componentData.splice(index, 1) + } + } + } } }, modules: {