Skip to content

Commit

Permalink
fix(Menu): 左侧菜单混合模式 在动态更改路由时,左侧显示的菜单没有实时更新
Browse files Browse the repository at this point in the history
  • Loading branch information
zuihou committed Oct 29, 2021
1 parent 5225345 commit 5c491a4
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/layouts/default/sider/MixSider.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,14 @@
<script lang="ts">
import type { Menu } from '/@/router/types';
import type { CSSProperties } from 'vue';
import { computed, defineComponent, onMounted, ref, unref } from 'vue';
import { computed, defineComponent, onMounted, ref, unref, watch } from 'vue';
import type { RouteLocationNormalized } from 'vue-router';
import { ScrollContainer } from '/@/components/Container';
import { SimpleMenu, SimpleMenuTag } from '/@/components/SimpleMenu';
import { Icon } from '/@/components/Icon';
import { AppLogo } from '/@/components/Application';
import { useMenuSetting } from '/@/hooks/setting/useMenuSetting';
import { usePermissionStore } from '/@/store/modules/permission';
import { useDragLine } from './useLayoutSider';
import { useGlobSetting } from '/@/hooks/setting';
import { useDesign } from '/@/hooks/web/useDesign';
Expand Down Expand Up @@ -138,6 +139,7 @@
} = useMenuSetting();
const { title } = useGlobSetting();
const permissionStore = usePermissionStore();
useDragLine(sideRef, dragBarRef, true);
Expand Down Expand Up @@ -191,6 +193,17 @@
menuModules.value = await getShallowMenus();
});
// Menu changes
watch(
[() => permissionStore.getLastBuildMenuTime, () => permissionStore.getBackMenuList],
async () => {
menuModules.value = await getShallowMenus();
},
{
immediate: true,
},
);
listenerRouteChange((route) => {
currentRoute.value = route;
setActive(true);
Expand Down

0 comments on commit 5c491a4

Please sign in to comment.