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