Skip to content

Commit

Permalink
Update routeHelper.ts (#3217)
Browse files Browse the repository at this point in the history
某些情况下如果name如果没有值, 多个一级路由菜单会导致页面404
  • Loading branch information
path-yu authored Oct 31, 2023
1 parent ed267d9 commit 295f7ee
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/router/helper/routeHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,11 @@ export function transformObjToRoute<T = AppRouteModule>(routeList: AppRouteModul
} else {
route.children = [cloneDeep(route)];
route.component = LAYOUT;
route.name = `${route.name}Parent`;
//某些情况下如果name如果没有值, 多个一级路由菜单会导致页面404
if (!route.name || !route.menuName) {
warn('找不到菜单对应的name或menuName, 请检查数据!');
}
route.name = `${route.name || route.menuName}Parent`;
route.path = '';
const meta = route.meta || {};
meta.single = true;
Expand Down

1 comment on commit 295f7ee

@BenXi630
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

类型“AppRouteRecordRaw”上不存在属性“menuName”。

Please sign in to comment.