mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-01-23 09:40:25 +08:00
chore: 优化查找根菜单的逻辑
This commit is contained in:
parent
ad6ae1d21d
commit
0b00c7bf06
@ -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…
Reference in New Issue
Block a user