Skip to content

Commit 3a3cfcc

Browse files
committed
refine : router/index.js
1 parent 635a43b commit 3a3cfcc

File tree

1 file changed

+6
-19
lines changed

1 file changed

+6
-19
lines changed

src/router/index.js

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,6 @@ const _import = require('./_import_' + process.env.NODE_ENV)
66
/* layout */
77
import Layout from '../views/layout/Layout'
88

9-
/* login */
10-
const Login = _import('login/index')
11-
12-
/* dashboard */
13-
const dashboard = _import('dashboard/index')
14-
15-
/* error page */
16-
const Err404 = _import('404')
17-
18-
/* demo page */
19-
const Form = _import('page/form')
20-
const Table = _import('table/index')
21-
229
Vue.use(Router)
2310

2411
/**
@@ -29,15 +16,15 @@ Vue.use(Router)
2916
* meta : `{ role: ['admin'] }` will control the page role
3017
**/
3118
export const constantRouterMap = [
32-
{ path: '/login', component: Login, hidden: true },
33-
{ path: '/404', component: Err404, hidden: true },
19+
{ path: '/login', component: _import('login/index'), hidden: true },
20+
{ path: '/404', component: _import('404'), hidden: true },
3421
{
3522
path: '/',
3623
component: Layout,
3724
redirect: '/dashboard',
38-
name: 'Home',
25+
name: 'Dashboard',
3926
hidden: true,
40-
children: [{ path: 'dashboard', component: dashboard }]
27+
children: [{ path: 'dashboard', component: _import('dashboard/index') }]
4128
}
4229
]
4330

@@ -55,7 +42,7 @@ export const asyncRouterMap = [
5542
name: 'Example',
5643
icon: 'zujian',
5744
children: [
58-
{ path: 'index', component: Form, name: 'Form', icon: 'zonghe' }
45+
{ path: 'index', name: 'Form', icon: 'zonghe', component: _import('page/form') }
5946
]
6047
},
6148

@@ -65,7 +52,7 @@ export const asyncRouterMap = [
6552
redirect: '/table/index',
6653
icon: 'tubiao',
6754
noDropdown: true,
68-
children: [{ path: 'index', component: Table, name: 'Table', meta: { role: ['admin'] }}]
55+
children: [{ path: 'index', name: 'Table', component: _import('table/index'), meta: { role: ['admin'] }}]
6956
},
7057

7158
{ path: '*', redirect: '/404', hidden: true }

0 commit comments

Comments
 (0)