From 136d2cf21605eab106aa2703600181af01fcffac Mon Sep 17 00:00:00 2001 From: Hooray Hu <304327508@qq.com> Date: Sat, 6 May 2023 16:16:42 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=9E=84=E6=AC=A1=E5=AF=BC=E8=88=AA?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E5=B1=95=E5=BC=80=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layouts/components/SubSidebar/index.vue | 27 ++++++++++++--------- src/store/modules/menu.ts | 6 +++-- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/src/layouts/components/SubSidebar/index.vue b/src/layouts/components/SubSidebar/index.vue index 3f313d0..15defe0 100644 --- a/src/layouts/components/SubSidebar/index.vue +++ b/src/layouts/components/SubSidebar/index.vue @@ -22,18 +22,21 @@ function onSidebarScroll(e: Event) { 'shadow': sidebarScrollTop, }" /> - - - - - - + + + diff --git a/src/store/modules/menu.ts b/src/store/modules/menu.ts index d416b87..912ff7a 100644 --- a/src/store/modules/menu.ts +++ b/src/store/modules/menu.ts @@ -73,9 +73,11 @@ const useMenuStore = defineStore( } // 默认展开的导航路径 const defaultOpenedPaths = computed(() => { - let defaultOpenedPaths: string[] = [] + const defaultOpenedPaths: string[] = [] if (settingsStore.settings.app.routeBaseOn !== 'filesystem') { - defaultOpenedPaths = getDefaultOpenedPaths(sidebarMenus.value) + allMenus.value.forEach((item) => { + defaultOpenedPaths.push(...getDefaultOpenedPaths(item.children)) + }) } return defaultOpenedPaths })