feat(route): add hideChildrenInMenu option close #346

This commit is contained in:
Vben
2021-03-18 21:13:15 +08:00
parent f55ad2f90a
commit b67cf22dfc
11 changed files with 43 additions and 70 deletions

View File

@@ -66,9 +66,9 @@ export async function getShallowMenus(): Promise<Menu[]> {
// Get the children of the menu
export async function getChildrenMenus(parentPath: string) {
const menus = await getAsyncMenus();
const menus = await getMenus();
const parent = menus.find((item) => item.path === parentPath);
if (!parent || !parent.children) return [] as Menu[];
if (!parent || !parent.children || !!parent?.meta?.hideChildrenInMenu) return [] as Menu[];
const routes = router.getRoutes();
return !isBackMode() ? filter(parent.children, basicFilter(routes)) : parent.children;