Skip to content

Commit

Permalink
fix(router): resolve menu loading failure when permission is in "role…
Browse files Browse the repository at this point in the history
… mode" (#3660)

closed #3655
  • Loading branch information
cszhjh committed Mar 7, 2024
1 parent a4cc1d5 commit c7631fe
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
4 changes: 1 addition & 3 deletions src/router/helper/menuHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ function joinParentPath(menus: Menu[], parentPath = '') {

// Parsing the menu module
export function transformMenuModule(menuModule: MenuModule): Menu {
const { menu } = menuModule;

const menuList = [menu];
const menuList = [menuModule];

joinParentPath(menuList);
return menuList[0];
Expand Down
2 changes: 1 addition & 1 deletion src/router/menus/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { router } from '@/router';
import { PermissionModeEnum } from '@/enums/appEnum';
import { pathToRegexp } from 'path-to-regexp';

const modules = import.meta.glob('./modules/**/*.ts', { eager: true });
const modules = import.meta.glob('../routes/modules/**/*.ts', { eager: true });

const menuModules: MenuModule[] = [];

Expand Down
5 changes: 1 addition & 4 deletions src/router/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,7 @@ export interface Menu {
hideMenu?: boolean;
}

export interface MenuModule {
orderNo?: number;
menu: Menu;
}
export type MenuModule = Menu;

// export type AppRouteModule = RouteModule | AppRouteRecordRaw;
export type AppRouteModule = AppRouteRecordRaw;

0 comments on commit c7631fe

Please sign in to comment.