From d172206d71ffc35a4863cf7d3c1c422899900a75 Mon Sep 17 00:00:00 2001 From: "Ray.Hao" <1490493387@qq.com> Date: Sun, 18 Jan 2026 09:00:03 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=BB=8E=E5=B7=A6?= =?UTF-8?q?=E4=BE=A7=E6=A8=A1=E5=BC=8F=E5=88=87=E5=88=B0=E6=B7=B7=E5=90=88?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F=E9=A6=96=E9=A1=B5=E4=B8=8D=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=9C=A8=E5=B7=A6=E4=BE=A7=E8=8F=9C=E5=8D=95=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layouts/MixLayout.vue | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/layouts/MixLayout.vue b/src/layouts/MixLayout.vue index 09f31fcb..b47357ff 100644 --- a/src/layouts/MixLayout.vue +++ b/src/layouts/MixLayout.vue @@ -207,8 +207,15 @@ watch( () => route.path, (newPath) => { const topMenuPath = extractTopMenuPath(newPath); - if (topMenuPath !== activeTopMenuPath.value) { + const isTopMenuChanged = topMenuPath !== activeTopMenuPath.value; + + if (isTopMenuChanged) { appStore.activeTopMenu(topMenuPath); + } + + // 切换布局(如左侧 -> 混合)时,activeTopMenuPath 可能已是正确值, + // 但 mixLayoutSideMenus 仍为空,需要补一次初始化。 + if (isTopMenuChanged || permissionStore.mixLayoutSideMenus.length === 0) { permissionStore.setMixLayoutSideMenus(topMenuPath); } },