From cfc3db597b0907fc75166adc0138489fe28824b1 Mon Sep 17 00:00:00 2001 From: Bowen Date: Sat, 7 Jul 2018 12:48:06 +0800 Subject: [PATCH] refactor(sidebar-item): optimizate SiderbarItem. --- src/router/index.js | 22 ++++++++++++++- .../layout/components/Sidebar/SidebarItem.vue | 28 ++++++++++++------- src/views/layout/components/Sidebar/index.vue | 2 +- src/views/nested/bar/foo/Ant.vue | 6 ++++ src/views/nested/bar/foo/Ant2.vue | 6 ++++ src/views/nested/bar/foo/index.vue | 6 ++++ src/views/nested/bar/index.vue | 2 +- src/views/nested/bar/posts.vue | 2 +- src/views/nested/bar/profile.vue | 2 +- 9 files changed, 61 insertions(+), 15 deletions(-) create mode 100644 src/views/nested/bar/foo/Ant.vue create mode 100644 src/views/nested/bar/foo/Ant2.vue create mode 100644 src/views/nested/bar/foo/index.vue diff --git a/src/router/index.js b/src/router/index.js index aaaccd8d..a455dd2e 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -210,7 +210,7 @@ export const asyncRouterMap = [ }, children: [ { - path: '/nested/bar', // Must write the full path + path: 'bar', component: () => import('@/views/nested/bar/index'), // Parent router-view name: 'bar', meta: { title: 'bar' }, @@ -226,6 +226,26 @@ export const asyncRouterMap = [ component: () => import('@/views/nested/bar/posts'), name: 'bar-posts', meta: { title: 'barPosts' } + }, + { + path: 'foo', + component: () => import('@/views/nested/bar/foo'), + name: 'bar-foo', + meta: { title: 'Foo' }, + children: [ + { + path: 'ant', + component: () => import('@/views/nested/bar/foo/Ant'), + name: 'bar-foo-ant', + meta: { title: 'Ant' } + }, + { + path: 'ant2', + component: () => import('@/views/nested/bar/foo/Ant2'), + name: 'bar-foo-ant2', + meta: { title: 'Ant2' } + } + ] } ] } diff --git a/src/views/layout/components/Sidebar/SidebarItem.vue b/src/views/layout/components/Sidebar/SidebarItem.vue index cddcd61d..2f839ae2 100644 --- a/src/views/layout/components/Sidebar/SidebarItem.vue +++ b/src/views/layout/components/Sidebar/SidebarItem.vue @@ -1,26 +1,25 @@