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', }, }, },