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]; + }); } }