将 menu 从 appstore 提出.

This commit is contained in:
lijiahangmax
2023-09-25 22:05:48 +08:00
parent 80e5e241fa
commit 99d6d16a04
23 changed files with 190 additions and 287 deletions

View File

@@ -1,9 +1,9 @@
import { RouteLocationNormalized, RouteRecordNormalized, RouteRecordRaw } from 'vue-router';
import { useAppStore, useUserStore } from '@/store';
import { useMenuStore, useUserStore } from '@/store';
import { STATUS_ROUTER_LIST, WHITE_ROUTER_LIST } from '@/router/constants';
export default function usePermission() {
const appStore = useAppStore();
const menuStore = useMenuStore();
const userStore = useUserStore();
return {
/**
@@ -15,7 +15,7 @@ export default function usePermission() {
return false;
}
// 检查路由是否存在于授权路由中
const menuConfig = [...appStore.appAsyncMenus, ...WHITE_ROUTER_LIST, ...STATUS_ROUTER_LIST];
const menuConfig = [...menuStore.appMenus, ...WHITE_ROUTER_LIST, ...STATUS_ROUTER_LIST];
let exist = false;
while (menuConfig.length && !exist) {
const element = menuConfig.shift();