From 327ed42e247bc3577948d8bfe8c6239bd803bab9 Mon Sep 17 00:00:00 2001 From: Pan Date: Wed, 31 May 2017 15:52:27 +0800 Subject: [PATCH] sidebar accept Nested Routes --- src/router/index.js | 24 ++++++---- src/views/example/{ => table}/dragTable.vue | 0 .../example/{ => table}/dynamictable.vue | 0 src/views/example/table/index.vue | 3 ++ .../example/{ => table}/inlineEditTable.vue | 0 src/views/example/{ => table}/table.vue | 0 src/views/layout/Sidebar.vue | 32 ++----------- src/views/layout/SidebarItem.vue | 46 +++++++++++++++++++ 8 files changed, 69 insertions(+), 36 deletions(-) rename src/views/example/{ => table}/dragTable.vue (100%) rename src/views/example/{ => table}/dynamictable.vue (100%) create mode 100644 src/views/example/table/index.vue rename src/views/example/{ => table}/inlineEditTable.vue (100%) rename src/views/example/{ => table}/table.vue (100%) create mode 100644 src/views/layout/SidebarItem.vue diff --git a/src/router/index.js b/src/router/index.js index e5b3de83..d7674a2c 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -51,10 +51,11 @@ const ExcelDownload = () => import('../views/excel/index'); const Theme = () => import('../views/theme/index'); /* example*/ -const DynamicTable = () => import('../views/example/dynamictable'); -const Table = () => import('../views/example/table'); -const DragTable = () => import('../views/example/dragTable'); -const InlineEditTable = () => import('../views/example/inlineEditTable'); +const TableLayout = () => import('../views/example/table/index'); +const DynamicTable = () => import('../views/example/table/dynamictable'); +const Table = () => import('../views/example/table/table'); +const DragTable = () => import('../views/example/table/dragTable'); +const InlineEditTable = () => import('../views/example/table/inlineEditTable'); const Form1 = () => import('../views/example/form1'); /* permission */ @@ -192,10 +193,17 @@ export const asyncRouterMap = [ name: '综合实例', icon: 'zonghe', children: [ - { path: 'dynamictable', component: DynamicTable, name: '动态table' }, - { path: 'dragtable', component: DragTable, name: '拖拽table' }, - { path: 'inline_edit_table', component: InlineEditTable, name: 'table内编辑' }, - { path: 'table', component: Table, name: '综合table' }, + { + path: '/table', + component: TableLayout, + name: 'table', + children: [ + { path: 'dynamictable', component: DynamicTable, name: '动态table' }, + { path: 'dragtable', component: DragTable, name: '拖拽table' }, + { path: 'inline_edit_table', component: InlineEditTable, name: 'table内编辑' }, + { path: 'table', component: Table, name: '综合table' } + ] + }, { path: 'form1', component: Form1, name: '综合form1' } ] }, diff --git a/src/views/example/dragTable.vue b/src/views/example/table/dragTable.vue similarity index 100% rename from src/views/example/dragTable.vue rename to src/views/example/table/dragTable.vue diff --git a/src/views/example/dynamictable.vue b/src/views/example/table/dynamictable.vue similarity index 100% rename from src/views/example/dynamictable.vue rename to src/views/example/table/dynamictable.vue diff --git a/src/views/example/table/index.vue b/src/views/example/table/index.vue new file mode 100644 index 00000000..a44ab87b --- /dev/null +++ b/src/views/example/table/index.vue @@ -0,0 +1,3 @@ + diff --git a/src/views/example/inlineEditTable.vue b/src/views/example/table/inlineEditTable.vue similarity index 100% rename from src/views/example/inlineEditTable.vue rename to src/views/example/table/inlineEditTable.vue diff --git a/src/views/example/table.vue b/src/views/example/table/table.vue similarity index 100% rename from src/views/example/table.vue rename to src/views/example/table/table.vue diff --git a/src/views/layout/Sidebar.vue b/src/views/layout/Sidebar.vue index c4cab5c0..d06f72f9 100644 --- a/src/views/layout/Sidebar.vue +++ b/src/views/layout/Sidebar.vue @@ -1,30 +1,14 @@ - diff --git a/src/views/layout/SidebarItem.vue b/src/views/layout/SidebarItem.vue new file mode 100644 index 00000000..2d9b85cf --- /dev/null +++ b/src/views/layout/SidebarItem.vue @@ -0,0 +1,46 @@ + + + + +