Browse Source

chore: 优化查找根菜单的逻辑

pull/3993/head
invalid w 2 years ago
parent
commit
0b00c7bf06
  1. 4
      packages/@core/forward/helpers/src/find-menu-by-path.ts

4
packages/@core/forward/helpers/src/find-menu-by-path.ts

@ -24,7 +24,9 @@ function findMenuByPath(
function findRootMenuByPath(menus: MenuRecordRaw[], path?: string) {
const findMenu = findMenuByPath(menus, path);
const rootMenuPath = findMenu?.parents?.[0];
const rootMenu = menus.find((item) => item.path === rootMenuPath);
const rootMenu = rootMenuPath
? menus.find((item) => item.path === rootMenuPath)
: undefined;
return {
findMenu,
rootMenu,

Loading…
Cancel
Save