diff --git a/src/router/hooks/use-permission-routes.tsx b/src/router/hooks/use-permission-routes.tsx index b3e0fc63..303fad29 100644 --- a/src/router/hooks/use-permission-routes.tsx +++ b/src/router/hooks/use-permission-routes.tsx @@ -32,6 +32,11 @@ function resolveComponent(path: string) { * return routes about permission */ export function usePermissionRoutes() { + // 切换回静态路由 + // return useMemo(() => { + // return getRoutesFromModules(); + // }, []); + const permissions = useUserPermission(); return useMemo(() => { diff --git a/src/router/routes/menu-routes.tsx b/src/router/routes/menu-routes.tsx index fa9126e3..69e1089f 100644 --- a/src/router/routes/menu-routes.tsx +++ b/src/router/routes/menu-routes.tsx @@ -3,11 +3,11 @@ import { Navigate } from 'react-router-dom'; import DashboardLayout from '@/layouts/dashboard'; import AuthGuard from '../components/auth-guard'; -import { getMenuModules } from '../utils'; +import { getRoutesFromModules } from '../utils'; import { AppRouteObject } from '#/router'; -const menuModuleRoutes = getMenuModules(); +const menuModuleRoutes = getRoutesFromModules(); const { VITE_APP_HOMEPAGE: HOMEPAGE } = import.meta.env; diff --git a/src/router/utils.ts b/src/router/utils.ts index 4e96f4e6..fd7bfa8b 100644 --- a/src/router/utils.ts +++ b/src/router/utils.ts @@ -20,7 +20,7 @@ export const menuFilter = (items: AppRouteObject[]) => { /** * 基于 src/router/routes/modules 文件结构动态生成路由 */ -export function getMenuModules() { +export function getRoutesFromModules() { const menuModules: AppRouteObject[] = []; const modules = import.meta.glob('./routes/modules/**/*.tsx', { eager: true });