Prechádzať zdrojové kódy

perf: 重置路由时,清空缓存页面

xiaoxian521 2 rokov pred
rodič
commit
3056527701

+ 0 - 2
src/layout/components/tag/index.vue

@@ -9,7 +9,6 @@ import { useResizeObserver, useDebounceFn } from "@vueuse/core";
 import { useSettingStoreHook } from "/@/store/modules/settings";
 import { useSettingStoreHook } from "/@/store/modules/settings";
 import { handleAliveRoute, delAliveRoutes } from "/@/router/utils";
 import { handleAliveRoute, delAliveRoutes } from "/@/router/utils";
 import { useMultiTagsStoreHook } from "/@/store/modules/multiTags";
 import { useMultiTagsStoreHook } from "/@/store/modules/multiTags";
-import { usePermissionStoreHook } from "/@/store/modules/permission";
 import { ref, watch, unref, toRaw, nextTick, onBeforeMount } from "vue";
 import { ref, watch, unref, toRaw, nextTick, onBeforeMount } from "vue";
 
 
 const {
 const {
@@ -276,7 +275,6 @@ function onClickDrop(key, item, selectRoute?: RouteConfigs) {
         startIndex: 1,
         startIndex: 1,
         length: multiTags.value.length
         length: multiTags.value.length
       });
       });
-      usePermissionStoreHook().clearAllCachePage();
       router.push("/welcome");
       router.push("/welcome");
       break;
       break;
   }
   }

+ 1 - 0
src/router/index.ts

@@ -106,6 +106,7 @@ export function resetRouter() {
       );
       );
     }
     }
   });
   });
+  usePermissionStoreHook().clearAllCachePage();
 }
 }
 
 
 // 路由白名单
 // 路由白名单

+ 3 - 0
src/store/modules/permission.ts

@@ -63,6 +63,9 @@ export const usePermissionStore = defineStore({
     },
     },
     // 清空缓存页面
     // 清空缓存页面
     clearAllCachePage() {
     clearAllCachePage() {
+      this.wholeMenus = [];
+      this.menusTree = [];
+      this.buttonAuth = [];
       this.cachePageList = [];
       this.cachePageList = [];
     }
     }
   }
   }