This commit is contained in:
dap
2025-03-22 18:31:19 +08:00
10 changed files with 42 additions and 18 deletions

View File

@@ -1,6 +1,7 @@
import type { ExRouteRecordRaw, MenuRecordRaw } from '@vben-core/typings';
import type { Router, RouteRecordRaw } from 'vue-router';
import type { ExRouteRecordRaw, MenuRecordRaw } from '@vben-core/typings';
import { filterTree, mapTree } from '@vben-core/shared/utils';
/**
@@ -68,8 +69,8 @@ async function generateMenus(
};
});
// 对菜单进行排序
menus = menus.sort((a, b) => (a.order || 999) - (b.order || 999));
// 对菜单进行排序避免order=0时被替换成999的问题
menus = menus.sort((a, b) => (a?.order ?? 999) - (b?.order ?? 999));
const finalMenus = filterTree(menus, (menu) => {
return !!menu.show;