vince 2024-07-05 23:16:15 +08:00
commit 7e18eb7471
1 changed files with 3 additions and 1 deletions

View File

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