diff --git a/packages/fineui/package.json b/packages/fineui/package.json index 509cc8077..17ef6a00a 100644 --- a/packages/fineui/package.json +++ b/packages/fineui/package.json @@ -60,4 +60,4 @@ "core-js": "^3.37.1", "cross-env": "^7.0.3" } -} \ No newline at end of file +} 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]; + }); } }