From 0395933470526e77d22f3d5d5fe81e9d021c7374 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=A0=E5=B1=8F=E5=B1=B1=E6=9C=80=E9=80=9F=E4=B8=8B?= =?UTF-8?q?=E5=B1=B1=E4=BC=A0=E8=AF=B4?= Date: Mon, 26 Aug 2024 11:13:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A0JIRA=20tab=E6=B7=BB=E5=8A=A0=E5=AD=90c?= =?UTF-8?q?ard=20destory=E7=9B=91=E5=90=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit df79823d5acdeee937b3349018fa259e38110b3a) --- packages/fineui/src/base/combination/tab.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/fineui/src/base/combination/tab.js b/packages/fineui/src/base/combination/tab.js index c9f79278a..8c6da9f4d 100644 --- a/packages/fineui/src/base/combination/tab.js +++ b/packages/fineui/src/base/combination/tab.js @@ -13,7 +13,8 @@ import { contains, any, isEqual, - LogicFactory + LogicFactory, + Events, } from "@/core"; /** @@ -106,7 +107,11 @@ export class Tab extends Widget { Widget.execWithContext(this, () => { this.cardMap[v] = cardCreator(v); }); - this.layout.addCardByName(v, this.cardMap[v]); + const card = this.layout.addCardByName(v, this.cardMap[v]); + card.on(Events.DESTROY, () => { + this.layout.deleteCardByName(v); + delete this.cardMap[v]; + }); } }