This commit is contained in:
dap
2024-12-30 19:38:01 +08:00
53 changed files with 359 additions and 93 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "@vben/utils",
"version": "5.5.1",
"version": "5.5.2",
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {

View File

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