Skip to content

Commit

Permalink
chore: 优化示例
Browse files Browse the repository at this point in the history
  • Loading branch information
RSS1102 committed Nov 4, 2024
1 parent 9f7066d commit 61e6e27
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 28 deletions.
10 changes: 2 additions & 8 deletions src/layouts/components/SideNav.vue
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,8 @@ const expanded = ref<MenuValue[]>([]);
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);
};
Expand Down
28 changes: 8 additions & 20 deletions src/router/modules/homepage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
},
},
Expand Down

0 comments on commit 61e6e27

Please sign in to comment.