Skip to content

Commit

Permalink
docs: 新增切换回静态路由的注释
Browse files Browse the repository at this point in the history
  • Loading branch information
d3george committed Apr 25, 2024
1 parent 0d530f7 commit bda7e39
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/router/hooks/use-permission-routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ function resolveComponent(path: string) {
* return routes about permission
*/
export function usePermissionRoutes() {
// 切换回静态路由
// return useMemo(() => {
// return getRoutesFromModules();
// }, []);

const permissions = useUserPermission();

return useMemo(() => {
Expand Down
4 changes: 2 additions & 2 deletions src/router/routes/menu-routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion src/router/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand Down

0 comments on commit bda7e39

Please sign in to comment.