From 054306236339a2cac4d340c03e85823c5318de2d Mon Sep 17 00:00:00 2001 From: hxr <1490493387@qq.com> Date: Tue, 25 Jun 2024 22:55:19 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20:bug:=20=E6=B7=B7=E5=90=88=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=E6=B8=85=E7=90=86activeTopMenuPath=E7=BC=93=E5=AD=98?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E9=A1=B6=E9=83=A8=E8=8F=9C=E5=8D=95=E6=BF=80?= =?UTF-8?q?=E6=B4=BB=E9=94=99=E8=AF=AF=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/Sidebar/components/SidebarMixTopMenu.vue | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/layout/components/Sidebar/components/SidebarMixTopMenu.vue b/src/layout/components/Sidebar/components/SidebarMixTopMenu.vue index 8a03e7d8..f05865f5 100644 --- a/src/layout/components/Sidebar/components/SidebarMixTopMenu.vue +++ b/src/layout/components/Sidebar/components/SidebarMixTopMenu.vue @@ -41,9 +41,14 @@ const appStore = useAppStore(); const permissionStore = usePermissionStore(); const router = useRouter(); +// 避免 activeTopMenuPath 缓存被清理,从当前路由路径获取顶部菜单路径,eg. /system/user → /system +const activeTopMenuPath = useRoute().path.replace(/\/[^\/]+$/, "") || "/"; +appStore.activeTopMenu(activeTopMenuPath); + +// 激活的顶部菜单路径 const activePath = computed(() => appStore.activeTopMenuPath); -// 顶部菜单集合 +// 混合模式顶部菜单集合 const mixTopMenus = ref([]); /**