fix: fix a series of known problems,fixed #54

This commit is contained in:
vince
2024-07-18 21:59:18 +08:00
parent 01e95e029f
commit 276ef2ebc3
36 changed files with 314 additions and 293 deletions

View File

@@ -1,6 +1,6 @@
import type { MenuRecordRaw } from '@vben-core/typings';
import { computed, ref } from 'vue';
import { computed, ref, watch } from 'vue';
import { useRoute } from 'vue-router';
import { findRootMenuByPath } from '@vben-core/helpers';
@@ -78,6 +78,18 @@ function useExtraMenu() {
}
};
watch(
() => route.path,
() => {
const { findMenu, rootMenu, rootMenuPath } = findRootMenuByPath(
menus.value,
route.path,
);
extraActiveMenu.value = rootMenuPath ?? findMenu?.path ?? '';
extraMenus.value = rootMenu?.children ?? [];
},
);
return {
extraActiveMenu,
extraMenus,