diff --git a/src/router/index.ts b/src/router/index.ts index 3d9700f7bf7d0f93f301a36483627fd4c29e9401..c349151543c4545b611220a191aac6a169c87e1e 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -2,10 +2,16 @@ import type { RouteRecordRaw } from 'vue-router'; import type { App } from 'vue'; import { createRouter, createWebHashHistory } from 'vue-router'; -import { basicRoutes, LoginRoute } from './routes'; -import { REDIRECT_NAME } from './constant'; +import { basicRoutes } from './routes'; -const WHITE_NAME_LIST = [LoginRoute.name, REDIRECT_NAME]; +// 白名单应该包含基本静态路由 +const WHITE_NAME_LIST: string[] = []; +const getRouteNames = (array: any[]) => + array.forEach((item) => { + WHITE_NAME_LIST.push(item.name); + getRouteNames(item.children || []); + }); +getRouteNames(basicRoutes); // app router export const router = createRouter({