Browse Source

fix: mixNav route

xiaoxian521 3 years ago
parent
commit
6fb0f7ef4d
1 changed files with 2 additions and 2 deletions
  1. 2 2
      src/layout/components/sidebar/mixNav.vue

+ 2 - 2
src/layout/components/sidebar/mixNav.vue

@@ -21,7 +21,6 @@ const routers = useRouter().options.routes;
 const menuRef = templateRef<ElRef | null>("menu", null);
 const instance =
   getCurrentInstance().appContext.config.globalProperties.$storage;
-const wholeMenus = usePermissionStoreHook().wholeMenus;
 
 const {
   logout,
@@ -39,6 +38,7 @@ const {
 let defaultActive = ref(null);
 
 function getDefaultActive(routePath) {
+  const wholeMenus = usePermissionStoreHook().wholeMenus;
   // 当前路由的父级路径
   const parentRoutes = getParentPaths(routePath, wholeMenus)[0];
   defaultActive.value = findRouteByPath(
@@ -113,7 +113,7 @@ function translationEn() {
       @select="indexPath => menuSelect(indexPath, routers)"
     >
       <el-menu-item
-        v-for="route in wholeMenus"
+        v-for="route in usePermissionStoreHook().wholeMenus"
         :key="route.path"
         :index="resolvePath(route) || route.redirect"
       >