Browse Source

refine : router/index.js

Pan 7 years ago
parent
commit
3a3cfcc69a
1 changed files with 6 additions and 19 deletions
  1. 6 19
      src/router/index.js

+ 6 - 19
src/router/index.js

@@ -6,19 +6,6 @@ const _import = require('./_import_' + process.env.NODE_ENV)
6 6
 /* layout */
7 7
 import Layout from '../views/layout/Layout'
8 8
 
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
-
22 9
 Vue.use(Router)
23 10
 
24 11
  /**
@@ -29,15 +16,15 @@ Vue.use(Router)
29 16
   * meta : `{ role: ['admin'] }`  will control the page role
30 17
   **/
31 18
 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 },
34 21
   {
35 22
     path: '/',
36 23
     component: Layout,
37 24
     redirect: '/dashboard',
38
-    name: 'Home',
25
+    name: 'Dashboard',
39 26
     hidden: true,
40
-    children: [{ path: 'dashboard', component: dashboard }]
27
+    children: [{ path: 'dashboard', component: _import('dashboard/index') }]
41 28
   }
42 29
 ]
43 30
 
@@ -55,7 +42,7 @@ export const asyncRouterMap = [
55 42
     name: 'Example',
56 43
     icon: 'zujian',
57 44
     children: [
58
-      { path: 'index', component: Form, name: 'Form', icon: 'zonghe' }
45
+      { path: 'index', name: 'Form', icon: 'zonghe', component: _import('page/form') }
59 46
     ]
60 47
   },
61 48
 
@@ -65,7 +52,7 @@ export const asyncRouterMap = [
65 52
     redirect: '/table/index',
66 53
     icon: 'tubiao',
67 54
     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'] }}]
69 56
   },
70 57
 
71 58
   { path: '*', redirect: '/404', hidden: true }