From 37b6253e14223f9236af0c6344d0d060f9c7cd58 Mon Sep 17 00:00:00 2001 From: Pan Date: Fri, 24 Nov 2017 17:08:30 +0800 Subject: [PATCH] feat:add tree demo --- src/components/Breadcrumb/index.vue | 2 +- src/icons/svg/tree.svg | 1 + src/router/index.js | 35 ++++++---- src/views/{page/form.vue => form/index.vue} | 0 src/views/tree/index.vue | 71 +++++++++++++++++++++ 5 files changed, 94 insertions(+), 15 deletions(-) create mode 100644 src/icons/svg/tree.svg rename src/views/{page/form.vue => form/index.vue} (100%) create mode 100644 src/views/tree/index.vue diff --git a/src/components/Breadcrumb/index.vue b/src/components/Breadcrumb/index.vue index 5864163..67f5ed0 100644 --- a/src/components/Breadcrumb/index.vue +++ b/src/components/Breadcrumb/index.vue @@ -24,7 +24,7 @@ export default { let matched = this.$route.matched.filter(item => item.name) const first = matched[0] if (first && first.name !== 'dashboard') { - matched = [{ path: '/dashboard', meta: { title: 'dashboard' }}].concat(matched) + matched = [{ path: '/dashboard', meta: { title: 'Dashboard' }}].concat(matched) } this.levelList = matched } diff --git a/src/icons/svg/tree.svg b/src/icons/svg/tree.svg new file mode 100644 index 0000000..11cedc0 --- /dev/null +++ b/src/icons/svg/tree.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/router/index.js b/src/router/index.js index cb2bffe..2b78858 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -21,6 +21,7 @@ import Layout from '../views/layout/Layout' export const constantRouterMap = [ { path: '/login', component: _import('login/index'), hidden: true }, { path: '/404', component: _import('404'), hidden: true }, + { path: '/', component: Layout, @@ -29,36 +30,42 @@ export const constantRouterMap = [ hidden: true, children: [{ path: 'dashboard', - component: _import('dashboard/index'), - meta: { title: 'dashboard', icon: 'dashboard' } + component: _import('dashboard/index') }] }, { path: '/example', component: Layout, - redirect: 'noredirect', + redirect: '/example/table', name: 'Example', meta: { title: 'Example', icon: 'example' }, children: [ { - path: 'index', - name: 'Form', - component: _import('page/form'), - meta: { title: 'Form', icon: 'form' } + path: 'table', + name: 'Table', + component: _import('table/index'), + meta: { title: 'Table', icon: 'table' } + }, + { + path: 'tree', + name: 'Tree', + component: _import('tree/index'), + meta: { title: 'Tree', icon: 'tree' } } ] }, { - path: '/table', + path: '/form', component: Layout, - redirect: '/table/index', - children: [{ - path: 'index', - name: 'Table', - component: _import('table/index'), - meta: { title: 'Table', icon: 'table' }} + children: [ + { + path: 'index', + name: 'Form', + component: _import('form/index'), + meta: { title: 'Form', icon: 'form' } + } ] }, diff --git a/src/views/page/form.vue b/src/views/form/index.vue similarity index 100% rename from src/views/page/form.vue rename to src/views/form/index.vue diff --git a/src/views/tree/index.vue b/src/views/tree/index.vue new file mode 100644 index 0000000..2bfa696 --- /dev/null +++ b/src/views/tree/index.vue @@ -0,0 +1,71 @@ + + + +