From 8571a27a1567e67aabf5e49012dc2c197b2cf40f Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sun, 3 May 2026 00:28:27 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E3=80=90framework=E3=80=91=E5=85=B3?= =?UTF-8?q?=E9=97=AD=20TagsView=20=E6=A0=87=E7=AD=BE=E5=90=8E=20keep-alive?= =?UTF-8?q?=20=E7=BC=93=E5=AD=98=E6=9C=AA=E6=94=B6=E7=BC=A9=EF=BC=8C?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=20DOM=EF=BC=8FJS=20heap=20=E4=B8=8D=E5=9B=9E?= =?UTF-8?q?=E6=94=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit delView/delAllViews 误用 delCachedView,关闭非当前标签时会去删 currentRoute 对应的缓存,把要关的 name 留在 cachedViews 里,keep-alive include 不收缩, 旧组件实例无法 unmount。 回退到基于剩余 visitedViews 重建 cachedViews 的实现(对应 5718c7881 之前的写法); delCachedView 自身保留 issue #180 的修复,仍供 refreshPage 使用。 --- src/store/modules/tagsView.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/store/modules/tagsView.ts b/src/store/modules/tagsView.ts index b54063512..9a07d9604 100644 --- a/src/store/modules/tagsView.ts +++ b/src/store/modules/tagsView.ts @@ -78,7 +78,7 @@ export const useTagsViewStore = defineStore('tagsView', { // 删除某个 delView(view: RouteLocationNormalizedLoaded) { this.delVisitedView(view) - this.delCachedView() + this.addCachedView() }, // 删除tag delVisitedView(view: RouteLocationNormalizedLoaded) { @@ -106,7 +106,7 @@ export const useTagsViewStore = defineStore('tagsView', { // 删除所有缓存和tag delAllViews() { this.delAllVisitedViews() - this.delCachedView() + this.addCachedView() }, // 删除所有tag delAllVisitedViews() {