From 61e6e27bc1e060c05d09268c9fa639e8d63e6cac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=98=BF=E8=8F=9C=20Cai?= Date: Mon, 4 Nov 2024 14:20:18 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E4=BC=98=E5=8C=96=E7=A4=BA=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layouts/components/SideNav.vue | 10 ++-------- src/router/modules/homepage.ts | 28 ++++++++-------------------- 2 files changed, 10 insertions(+), 28 deletions(-) diff --git a/src/layouts/components/SideNav.vue b/src/layouts/components/SideNav.vue index 90a195d7..420a7f24 100644 --- a/src/layouts/components/SideNav.vue +++ b/src/layouts/components/SideNav.vue @@ -82,14 +82,8 @@ const expanded = ref([]); const getExpanded = () => { const path = getActive(); - const parts = path.split('/'); - const result = []; - let currentPath = ''; - - for (let i = 1; i < parts.length - 1; i++) { - currentPath += `/${parts[i]}`; - result.push(currentPath); - } + const parts = path.split('/').slice(1); + const result = parts.map((_, index) => `/${parts.slice(0, index + 1).join('/')}`); expanded.value = menuAutoCollapsed.value ? result : union(result, expanded.value); }; diff --git a/src/router/modules/homepage.ts b/src/router/modules/homepage.ts index cc00b169..20dbf259 100644 --- a/src/router/modules/homepage.ts +++ b/src/router/modules/homepage.ts @@ -30,35 +30,23 @@ export default [ }, }, { - path: 'detail', - name: 'DashboardDetail', - // component: () => import('@/pages/dashboard/detail/index.vue'), + path: 'dashboard', + name: 'Dashboard', meta: { title: { - zh_CN: '统计报表', - en_US: 'Dashboard Detail', + zh_CN: '报表', + en_US: 'Dashboard', }, }, children: [ { - path: 'base-1', - name: 'DashboardBase-1', - component: () => import('@/pages/dashboard/base/index.vue'), - meta: { - title: { - zh_CN: '概览仪表盘-1', - en_US: 'Overview-1', - }, - }, - }, - { - path: 'detail-1', - name: 'DashboardDetail-1', + path: 'detail', + name: 'Detail', component: () => import('@/pages/dashboard/detail/index.vue'), meta: { title: { - zh_CN: '统计报表-1', - en_US: 'Dashboard Detail-1', + zh_CN: '统计报表', + en_US: 'Dashboard Detail', }, }, },