From 15e90ba9f0718460fa35e4cecc618c9c1d8402e0 Mon Sep 17 00:00:00 2001 From: taylor <709161610@qq.com> Date: Tue, 24 Jan 2017 17:30:30 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BA=8C=E7=BA=A7=E8=8F=9C=E5=8D=95=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E8=AE=BE=E7=BD=AE=E9=9A=90=E8=97=8Fhidden:true=20bug?= =?UTF-8?q?=20fix=202.=E6=B7=BB=E5=8A=A0routes.js?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 25 +++++++++++-------- src/main.js | 62 +--------------------------------------------- src/pages/Home.vue | 2 +- src/routes.js | 62 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 78 insertions(+), 73 deletions(-) create mode 100644 src/routes.js diff --git a/index.html b/index.html index dfafab8..4d5b147 100644 --- a/index.html +++ b/index.html @@ -1,13 +1,16 @@ - - - vue element admin - - -
- -
- - - + + + + vue element admin + + + +
+ +
+ + + + \ No newline at end of file diff --git a/src/main.js b/src/main.js index ba5fbd7..34e845b 100644 --- a/src/main.js +++ b/src/main.js @@ -8,17 +8,7 @@ import store from './vuex/store' import Vuex from 'vuex' import NProgress from 'nprogress'//页面顶部进度条 import 'nprogress/nprogress.css' - -import Login from './pages/Login.vue' -import Home from './pages/Home.vue' -import Main from './pages/Main.vue' -import Table from './pages/nav1/Table.vue' -import Form from './pages/nav1/Form.vue' -import user from './pages/nav1/user.vue' -import Page4 from './pages/nav2/Page4.vue' -import Page5 from './pages/nav2/Page5.vue' -import Page6 from './pages/nav3/Page6.vue' -import echarts from './pages/charts/echarts.vue' +import routes from './routes' // start mock import Mock from './mock'; @@ -30,56 +20,6 @@ Vue.use(Vuex) NProgress.configure({ showSpinner: false }); -const routes = [ - { - path: '/login', - component: Login, - hidden: true//不显示在导航中 - }, - //{ path: '/main', component: Main }, - { - path: '/', - component: Home, - name: '导航一', - iconCls: 'el-icon-message',//图标样式class - children: [ - //{ path: '/main', component: Main }, - { path: '/table', component: Table, name: 'Table' }, - { path: '/form', component: Form, name: 'Form' }, - { path: '/user', component: user, name: '列表' }, - ] - }, - { - path: '/', - component: Home, - name: '导航二', - iconCls: 'fa fa-id-card-o', - children: [ - { path: '/page4', component: Page4, name: '页面4' }, - { path: '/page5', component: Page5, name: '页面5' } - ] - }, - { - path: '/', - component: Home, - name: '', - iconCls: 'fa fa-address-card', - leaf: true,//只有一个节点 - children: [ - { path: '/page6', component: Page6, name: '导航三' } - ] - }, - { - path: '/', - component: Home, - name: 'Charts', - iconCls: 'fa fa-bar-chart', - children: [ - { path: '/echarts', component: echarts, name: 'echarts' } - ] - } -] - const router = new VueRouter({ routes }) diff --git a/src/pages/Home.vue b/src/pages/Home.vue index d161826..3a5964c 100644 --- a/src/pages/Home.vue +++ b/src/pages/Home.vue @@ -45,7 +45,7 @@ diff --git a/src/routes.js b/src/routes.js new file mode 100644 index 0000000..d1915b7 --- /dev/null +++ b/src/routes.js @@ -0,0 +1,62 @@ +import Login from './pages/Login.vue' +import Home from './pages/Home.vue' +import Main from './pages/Main.vue' +import Table from './pages/nav1/Table.vue' +import Form from './pages/nav1/Form.vue' +import user from './pages/nav1/user.vue' +import Page4 from './pages/nav2/Page4.vue' +import Page5 from './pages/nav2/Page5.vue' +import Page6 from './pages/nav3/Page6.vue' +import echarts from './pages/charts/echarts.vue' + +let routes = [ + { + path: '/login', + component: Login, + hidden: true//不显示在导航中 + }, + //{ path: '/main', component: Main }, + { + path: '/', + component: Home, + name: '导航一', + iconCls: 'el-icon-message',//图标样式class + children: [ + //{ path: '/main', component: Main }, + { path: '/table', component: Table, name: 'Table' }, + { path: '/form', component: Form, name: 'Form' }, + { path: '/user', component: user, name: '列表' }, + ] + }, + { + path: '/', + component: Home, + name: '导航二', + iconCls: 'fa fa-id-card-o', + children: [ + { path: '/page4', component: Page4, name: '页面4' }, + { path: '/page5', component: Page5, name: '页面5' } + ] + }, + { + path: '/', + component: Home, + name: '', + iconCls: 'fa fa-address-card', + leaf: true,//只有一个节点 + children: [ + { path: '/page6', component: Page6, name: '导航三' } + ] + }, + { + path: '/', + component: Home, + name: 'Charts', + iconCls: 'fa fa-bar-chart', + children: [ + { path: '/echarts', component: echarts, name: 'echarts' } + ] + } +]; + +export default routes; \ No newline at end of file