From 09cbc7ddc357386831bf9c87df58e33bc042d408 Mon Sep 17 00:00:00 2001 From: xiaoxian521 <1923740402@qq.com> Date: Tue, 9 May 2023 20:28:11 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=BC=80=E5=90=AF`kee?= =?UTF-8?q?pAlive`=E5=90=8E=E7=82=B9=E5=87=BB=E6=A0=87=E7=AD=BE=E9=A1=B5?= =?UTF-8?q?=E7=9A=84=E9=87=8D=E6=96=B0=E5=8A=A0=E8=BD=BD=EF=BC=8C=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E7=BC=93=E5=AD=98=E8=BF=98=E5=AD=98=E5=9C=A8=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layout/components/tag/index.vue | 1 + src/router/utils.ts | 6 ++++++ src/store/modules/permission.ts | 6 ++++-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/layout/components/tag/index.vue b/src/layout/components/tag/index.vue index a792b50db..704adc6ce 100644 --- a/src/layout/components/tag/index.vue +++ b/src/layout/components/tag/index.vue @@ -169,6 +169,7 @@ function onFresh() { path: "/redirect" + fullPath, query }); + handleAliveRoute(route as toRouteType, "refresh"); } function deleteDynamicTag(obj: any, current: any, tag?: string) { diff --git a/src/router/utils.ts b/src/router/utils.ts index ed82c13ce..98c98f512 100644 --- a/src/router/utils.ts +++ b/src/router/utils.ts @@ -270,6 +270,12 @@ function handleAliveRoute({ name }: toRouteType, mode?: string) { name }); break; + case "refresh": + usePermissionStoreHook().cacheOperate({ + mode: "refresh", + name + }); + break; default: usePermissionStoreHook().cacheOperate({ mode: "delete", diff --git a/src/store/modules/permission.ts b/src/store/modules/permission.ts index 8d8a85873..e357c9006 100644 --- a/src/store/modules/permission.ts +++ b/src/store/modules/permission.ts @@ -24,13 +24,15 @@ export const usePermissionStore = defineStore({ ); }, cacheOperate({ mode, name }: cacheType) { + const delIndex = this.cachePageList.findIndex(v => v === name); switch (mode) { + case "refresh": + this.cachePageList = this.cachePageList.filter(v => v !== name); + break; case "add": this.cachePageList.push(name); break; case "delete": - // eslint-disable-next-line no-case-declarations - const delIndex = this.cachePageList.findIndex(v => v === name); delIndex !== -1 && this.cachePageList.splice(delIndex, 1); break; }