Commit 5c491a42586c9bcbc18a57039dcee2c9810afba2
1 parent
52253454
fix(Menu): 左侧菜单混合模式 在动态更改路由时,左侧显示的菜单没有实时更新
Showing
1 changed file
with
14 additions
and
1 deletions
src/layouts/default/sider/MixSider.vue
... | ... | @@ -80,13 +80,14 @@ |
80 | 80 | <script lang="ts"> |
81 | 81 | import type { Menu } from '/@/router/types'; |
82 | 82 | import type { CSSProperties } from 'vue'; |
83 | - import { computed, defineComponent, onMounted, ref, unref } from 'vue'; | |
83 | + import { computed, defineComponent, onMounted, ref, unref, watch } from 'vue'; | |
84 | 84 | import type { RouteLocationNormalized } from 'vue-router'; |
85 | 85 | import { ScrollContainer } from '/@/components/Container'; |
86 | 86 | import { SimpleMenu, SimpleMenuTag } from '/@/components/SimpleMenu'; |
87 | 87 | import { Icon } from '/@/components/Icon'; |
88 | 88 | import { AppLogo } from '/@/components/Application'; |
89 | 89 | import { useMenuSetting } from '/@/hooks/setting/useMenuSetting'; |
90 | + import { usePermissionStore } from '/@/store/modules/permission'; | |
90 | 91 | import { useDragLine } from './useLayoutSider'; |
91 | 92 | import { useGlobSetting } from '/@/hooks/setting'; |
92 | 93 | import { useDesign } from '/@/hooks/web/useDesign'; |
... | ... | @@ -138,6 +139,7 @@ |
138 | 139 | } = useMenuSetting(); |
139 | 140 | |
140 | 141 | const { title } = useGlobSetting(); |
142 | + const permissionStore = usePermissionStore(); | |
141 | 143 | |
142 | 144 | useDragLine(sideRef, dragBarRef, true); |
143 | 145 | |
... | ... | @@ -191,6 +193,17 @@ |
191 | 193 | menuModules.value = await getShallowMenus(); |
192 | 194 | }); |
193 | 195 | |
196 | + // Menu changes | |
197 | + watch( | |
198 | + [() => permissionStore.getLastBuildMenuTime, () => permissionStore.getBackMenuList], | |
199 | + async () => { | |
200 | + menuModules.value = await getShallowMenus(); | |
201 | + }, | |
202 | + { | |
203 | + immediate: true, | |
204 | + }, | |
205 | + ); | |
206 | + | |
194 | 207 | listenerRouteChange((route) => { |
195 | 208 | currentRoute.value = route; |
196 | 209 | setActive(true); | ... | ... |