mirror of
https://github.com/vbenjs/gf-vben-admin.git
synced 2025-01-23 20:00:19 +08:00
fix(menu): currentActiveMenu fails after refresh #188
This commit is contained in:
parent
0aeec5e9d7
commit
6d5c49f0a2
@ -58,6 +58,7 @@
|
||||
emits: ['menuClick'],
|
||||
setup(props, { emit }) {
|
||||
const isClickGo = ref(false);
|
||||
const currentActiveMenu = ref('');
|
||||
|
||||
const menuState = reactive<MenuState>({
|
||||
defaultSelectedKeys: [],
|
||||
@ -118,10 +119,11 @@
|
||||
listenerLastChangeTab((route) => {
|
||||
if (route.name === REDIRECT_NAME) return;
|
||||
handleMenuChange(route);
|
||||
const currentActiveMenu = route.meta?.currentActiveMenu;
|
||||
if (currentActiveMenu) {
|
||||
menuState.selectedKeys = [currentActiveMenu];
|
||||
setOpenKeys(currentActiveMenu);
|
||||
currentActiveMenu.value = route.meta?.currentActiveMenu;
|
||||
|
||||
if (unref(currentActiveMenu)) {
|
||||
menuState.selectedKeys = [unref(currentActiveMenu)];
|
||||
setOpenKeys(unref(currentActiveMenu));
|
||||
}
|
||||
});
|
||||
|
||||
@ -153,6 +155,7 @@
|
||||
}
|
||||
const path = (route || unref(currentRoute)).path;
|
||||
setOpenKeys(path);
|
||||
if (unref(currentActiveMenu)) return;
|
||||
if (props.isHorizontal && unref(getSplit)) {
|
||||
const parentPath = await getCurrentParentPath(path);
|
||||
menuState.selectedKeys = [parentPath];
|
||||
|
Loading…
Reference in New Issue
Block a user