1
1
import Vue from 'vue'
2
2
import Router from 'vue-router'
3
- const _import = require ( './_import_' + process . env . NODE_ENV )
4
- // in development-env not use lazy-loading, because lazy-loading too many pages will cause webpack hot update too slow. so only in production use lazy-loading;
5
- // detail: https://panjiachen.github.io/vue-element-admin-site/#/lazy-loading
6
3
7
4
Vue . use ( Router )
8
5
9
6
/* Layout */
10
- import Layout from '.. /views/layout/Layout'
7
+ import Layout from '@ /views/layout/Layout'
11
8
12
9
/** note: submenu only apppear when children.length>=1
13
10
* detail see https://panjiachen.github.io/vue-element-admin-site/#/router-and-nav?id=sidebar
@@ -28,17 +25,17 @@ import Layout from '../views/layout/Layout'
28
25
}
29
26
**/
30
27
export const constantRouterMap = [
31
- { path : '/login' , component : _import ( ' login/index') , hidden : true } ,
32
- { path : '/authredirect' , component : _import ( ' login/authredirect') , hidden : true } ,
33
- { path : '/404' , component : _import ( ' errorPage/404') , hidden : true } ,
34
- { path : '/401' , component : _import ( ' errorPage/401') , hidden : true } ,
28
+ { path : '/login' , component : ( ) => import ( '@/views/ login/index') , hidden : true } ,
29
+ { path : '/authredirect' , component : ( ) => import ( '@/views/ login/authredirect') , hidden : true } ,
30
+ { path : '/404' , component : ( ) => import ( '@/views/ errorPage/404') , hidden : true } ,
31
+ { path : '/401' , component : ( ) => import ( '@/views/ errorPage/401') , hidden : true } ,
35
32
{
36
33
path : '' ,
37
34
component : Layout ,
38
35
redirect : 'dashboard' ,
39
36
children : [ {
40
37
path : 'dashboard' ,
41
- component : _import ( ' dashboard/index') ,
38
+ component : ( ) => import ( '@/views/ dashboard/index') ,
42
39
name : 'dashboard' ,
43
40
meta : { title : 'dashboard' , icon : 'dashboard' , noCache : true }
44
41
} ]
@@ -49,7 +46,7 @@ export const constantRouterMap = [
49
46
redirect : '/documentation/index' ,
50
47
children : [ {
51
48
path : 'index' ,
52
- component : _import ( ' documentation/index') ,
49
+ component : ( ) => import ( '@/views/ documentation/index') ,
53
50
name : 'documentation' ,
54
51
meta : { title : 'documentation' , icon : 'documentation' , noCache : true }
55
52
} ]
@@ -60,7 +57,7 @@ export const constantRouterMap = [
60
57
redirect : '/guide/index' ,
61
58
children : [ {
62
59
path : 'index' ,
63
- component : _import ( ' guide/index') ,
60
+ component : ( ) => import ( '@/views/ guide/index') ,
64
61
name : 'guide' ,
65
62
meta : { title : 'guide' , icon : 'guide' , noCache : true }
66
63
} ]
@@ -86,15 +83,15 @@ export const asyncRouterMap = [
86
83
} ,
87
84
children : [ {
88
85
path : 'page' ,
89
- component : _import ( ' permission/page') ,
86
+ component : ( ) => import ( '@/views/ permission/page') ,
90
87
name : 'pagePermission' ,
91
88
meta : {
92
89
title : 'pagePermission' ,
93
90
roles : [ 'admin' ] // or you can only set roles in sub nav
94
91
}
95
92
} , {
96
93
path : 'directive' ,
97
- component : _import ( ' permission/directive') ,
94
+ component : ( ) => import ( '@/views/ permission/directive') ,
98
95
name : 'directivePermission' ,
99
96
meta : {
100
97
title : 'directivePermission'
@@ -108,7 +105,7 @@ export const asyncRouterMap = [
108
105
component : Layout ,
109
106
children : [ {
110
107
path : 'index' ,
111
- component : _import ( ' svg-icons/index') ,
108
+ component : ( ) => import ( '@/views/ svg-icons/index') ,
112
109
name : 'icons' ,
113
110
meta : { title : 'icons' , icon : 'icon' , noCache : true }
114
111
} ]
@@ -124,19 +121,19 @@ export const asyncRouterMap = [
124
121
icon : 'component'
125
122
} ,
126
123
children : [
127
- { path : 'tinymce' , component : _import ( ' components-demo/tinymce') , name : 'tinymce-demo' , meta : { title : 'tinymce' } } ,
128
- { path : 'markdown' , component : _import ( ' components-demo/markdown') , name : 'markdown-demo' , meta : { title : 'markdown' } } ,
129
- { path : 'json-editor' , component : _import ( ' components-demo/jsonEditor') , name : 'jsonEditor-demo' , meta : { title : 'jsonEditor' } } ,
130
- { path : 'splitpane' , component : _import ( ' components-demo/splitpane') , name : 'splitpane-demo' , meta : { title : 'splitPane' } } ,
131
- { path : 'avatar-upload' , component : _import ( ' components-demo/avatarUpload') , name : 'avatarUpload-demo' , meta : { title : 'avatarUpload' } } ,
132
- { path : 'dropzone' , component : _import ( ' components-demo/dropzone') , name : 'dropzone-demo' , meta : { title : 'dropzone' } } ,
133
- { path : 'sticky' , component : _import ( ' components-demo/sticky') , name : 'sticky-demo' , meta : { title : 'sticky' } } ,
134
- { path : 'count-to' , component : _import ( ' components-demo/countTo') , name : 'countTo-demo' , meta : { title : 'countTo' } } ,
135
- { path : 'mixin' , component : _import ( ' components-demo/mixin') , name : 'componentMixin-demo' , meta : { title : 'componentMixin' } } ,
136
- { path : 'back-to-top' , component : _import ( ' components-demo/backToTop') , name : 'backToTop-demo' , meta : { title : 'backToTop' } } ,
137
- { path : 'drag-dialog' , component : _import ( ' components-demo/dragDialog') , name : 'dragDialog-demo' , meta : { title : 'dragDialog' } } ,
138
- { path : 'dnd-list' , component : _import ( ' components-demo/dndList') , name : 'dndList-demo' , meta : { title : 'dndList' } } ,
139
- { path : 'drag-kanban' , component : _import ( ' components-demo/dragKanban') , name : 'dragKanban-demo' , meta : { title : 'dragKanban' } }
124
+ { path : 'tinymce' , component : ( ) => import ( '@/views/ components-demo/tinymce') , name : 'tinymce-demo' , meta : { title : 'tinymce' } } ,
125
+ { path : 'markdown' , component : ( ) => import ( '@/views/ components-demo/markdown') , name : 'markdown-demo' , meta : { title : 'markdown' } } ,
126
+ { path : 'json-editor' , component : ( ) => import ( '@/views/ components-demo/jsonEditor') , name : 'jsonEditor-demo' , meta : { title : 'jsonEditor' } } ,
127
+ { path : 'splitpane' , component : ( ) => import ( '@/views/ components-demo/splitpane') , name : 'splitpane-demo' , meta : { title : 'splitPane' } } ,
128
+ { path : 'avatar-upload' , component : ( ) => import ( '@/views/ components-demo/avatarUpload') , name : 'avatarUpload-demo' , meta : { title : 'avatarUpload' } } ,
129
+ { path : 'dropzone' , component : ( ) => import ( '@/views/ components-demo/dropzone') , name : 'dropzone-demo' , meta : { title : 'dropzone' } } ,
130
+ { path : 'sticky' , component : ( ) => import ( '@/views/ components-demo/sticky') , name : 'sticky-demo' , meta : { title : 'sticky' } } ,
131
+ { path : 'count-to' , component : ( ) => import ( '@/views/ components-demo/countTo') , name : 'countTo-demo' , meta : { title : 'countTo' } } ,
132
+ { path : 'mixin' , component : ( ) => import ( '@/views/ components-demo/mixin') , name : 'componentMixin-demo' , meta : { title : 'componentMixin' } } ,
133
+ { path : 'back-to-top' , component : ( ) => import ( '@/views/ components-demo/backToTop') , name : 'backToTop-demo' , meta : { title : 'backToTop' } } ,
134
+ { path : 'drag-dialog' , component : ( ) => import ( '@/views/ components-demo/dragDialog') , name : 'dragDialog-demo' , meta : { title : 'dragDialog' } } ,
135
+ { path : 'dnd-list' , component : ( ) => import ( '@/views/ components-demo/dndList') , name : 'dndList-demo' , meta : { title : 'dndList' } } ,
136
+ { path : 'drag-kanban' , component : ( ) => import ( '@/views/ components-demo/dragKanban') , name : 'dragKanban-demo' , meta : { title : 'dragKanban' } }
140
137
]
141
138
} ,
142
139
@@ -150,9 +147,9 @@ export const asyncRouterMap = [
150
147
icon : 'chart'
151
148
} ,
152
149
children : [
153
- { path : 'keyboard' , component : _import ( ' charts/keyboard') , name : 'keyboardChart' , meta : { title : 'keyboardChart' , noCache : true } } ,
154
- { path : 'line' , component : _import ( ' charts/line') , name : 'lineChart' , meta : { title : 'lineChart' , noCache : true } } ,
155
- { path : 'mixchart' , component : _import ( ' charts/mixChart') , name : 'mixChart' , meta : { title : 'mixChart' , noCache : true } }
150
+ { path : 'keyboard' , component : ( ) => import ( '@/views/ charts/keyboard') , name : 'keyboardChart' , meta : { title : 'keyboardChart' , noCache : true } } ,
151
+ { path : 'line' , component : ( ) => import ( '@/views/ charts/line') , name : 'lineChart' , meta : { title : 'lineChart' , noCache : true } } ,
152
+ { path : 'mixchart' , component : ( ) => import ( '@/views/ charts/mixChart') , name : 'mixChart' , meta : { title : 'mixChart' , noCache : true } }
156
153
]
157
154
} ,
158
155
@@ -161,7 +158,7 @@ export const asyncRouterMap = [
161
158
component : Layout ,
162
159
children : [ {
163
160
path : 'index' ,
164
- component : _import ( ' tab/index') ,
161
+ component : ( ) => import ( '@/views/ tab/index') ,
165
162
name : 'tab' ,
166
163
meta : { title : 'tab' , icon : 'tab' }
167
164
} ]
@@ -177,12 +174,12 @@ export const asyncRouterMap = [
177
174
icon : 'table'
178
175
} ,
179
176
children : [
180
- { path : 'dynamic-table' , component : _import ( ' table/dynamicTable/index') , name : 'dynamicTable' , meta : { title : 'dynamicTable' } } ,
181
- { path : 'drag-table' , component : _import ( ' table/dragTable') , name : 'dragTable' , meta : { title : 'dragTable' } } ,
182
- { path : 'inline-edit-table' , component : _import ( ' table/inlineEditTable') , name : 'inlineEditTable' , meta : { title : 'inlineEditTable' } } ,
183
- { path : 'tree-table' , component : _import ( ' table/treeTable/treeTable') , name : 'treeTableDemo' , meta : { title : 'treeTable' } } ,
184
- { path : 'custom-tree-table' , component : _import ( ' table/treeTable/customTreeTable') , name : 'customTreeTableDemo' , meta : { title : 'customTreeTable' } } ,
185
- { path : 'complex-table' , component : _import ( ' table/complexTable') , name : 'complexTable' , meta : { title : 'complexTable' } }
177
+ { path : 'dynamic-table' , component : ( ) => import ( '@/views/ table/dynamicTable/index') , name : 'dynamicTable' , meta : { title : 'dynamicTable' } } ,
178
+ { path : 'drag-table' , component : ( ) => import ( '@/views/ table/dragTable') , name : 'dragTable' , meta : { title : 'dragTable' } } ,
179
+ { path : 'inline-edit-table' , component : ( ) => import ( '@/views/ table/inlineEditTable') , name : 'inlineEditTable' , meta : { title : 'inlineEditTable' } } ,
180
+ { path : 'tree-table' , component : ( ) => import ( '@/views/ table/treeTable/treeTable') , name : 'treeTableDemo' , meta : { title : 'treeTable' } } ,
181
+ { path : 'custom-tree-table' , component : ( ) => import ( '@/views/ table/treeTable/customTreeTable') , name : 'customTreeTableDemo' , meta : { title : 'customTreeTable' } } ,
182
+ { path : 'complex-table' , component : ( ) => import ( '@/views/ table/complexTable') , name : 'complexTable' , meta : { title : 'complexTable' } }
186
183
]
187
184
} ,
188
185
@@ -196,9 +193,9 @@ export const asyncRouterMap = [
196
193
icon : 'example'
197
194
} ,
198
195
children : [
199
- { path : 'create' , component : _import ( ' example/create') , name : 'createArticle' , meta : { title : 'createArticle' , icon : 'edit' } } ,
200
- { path : 'edit/:id(\\d+)' , component : _import ( ' example/edit') , name : 'editArticle' , meta : { title : 'editArticle' , noCache : true } , hidden : true } ,
201
- { path : 'list' , component : _import ( ' example/list') , name : 'articleList' , meta : { title : 'articleList' , icon : 'list' } }
196
+ { path : 'create' , component : ( ) => import ( '@/views/ example/create') , name : 'createArticle' , meta : { title : 'createArticle' , icon : 'edit' } } ,
197
+ { path : 'edit/:id(\\d+)' , component : ( ) => import ( '@/views/ example/edit') , name : 'editArticle' , meta : { title : 'editArticle' , noCache : true } , hidden : true } ,
198
+ { path : 'list' , component : ( ) => import ( '@/views/ example/list') , name : 'articleList' , meta : { title : 'articleList' , icon : 'list' } }
202
199
]
203
200
} ,
204
201
@@ -212,16 +209,16 @@ export const asyncRouterMap = [
212
209
icon : '404'
213
210
} ,
214
211
children : [
215
- { path : '401' , component : _import ( ' errorPage/401') , name : 'page401' , meta : { title : 'page401' , noCache : true } } ,
216
- { path : '404' , component : _import ( ' errorPage/404') , name : 'page404' , meta : { title : 'page404' , noCache : true } }
212
+ { path : '401' , component : ( ) => import ( '@/views/ errorPage/401') , name : 'page401' , meta : { title : 'page401' , noCache : true } } ,
213
+ { path : '404' , component : ( ) => import ( '@/views/ errorPage/404') , name : 'page404' , meta : { title : 'page404' , noCache : true } }
217
214
]
218
215
} ,
219
216
220
217
{
221
218
path : '/error-log' ,
222
219
component : Layout ,
223
220
redirect : 'noredirect' ,
224
- children : [ { path : 'log' , component : _import ( ' errorLog/index') , name : 'errorLog' , meta : { title : 'errorLog' , icon : 'bug' } } ]
221
+ children : [ { path : 'log' , component : ( ) => import ( '@/views/ errorLog/index') , name : 'errorLog' , meta : { title : 'errorLog' , icon : 'bug' } } ]
225
222
} ,
226
223
227
224
{
@@ -234,9 +231,9 @@ export const asyncRouterMap = [
234
231
icon : 'excel'
235
232
} ,
236
233
children : [
237
- { path : 'export-excel' , component : _import ( ' excel/exportExcel') , name : 'exportExcel' , meta : { title : 'exportExcel' } } ,
238
- { path : 'export-selected-excel' , component : _import ( ' excel/selectExcel') , name : 'selectExcel' , meta : { title : 'selectExcel' } } ,
239
- { path : 'upload-excel' , component : _import ( ' excel/uploadExcel') , name : 'uploadExcel' , meta : { title : 'uploadExcel' } }
234
+ { path : 'export-excel' , component : ( ) => import ( '@/views/ excel/exportExcel') , name : 'exportExcel' , meta : { title : 'exportExcel' } } ,
235
+ { path : 'export-selected-excel' , component : ( ) => import ( '@/views/ excel/selectExcel') , name : 'selectExcel' , meta : { title : 'selectExcel' } } ,
236
+ { path : 'upload-excel' , component : ( ) => import ( '@/views/ excel/uploadExcel') , name : 'uploadExcel' , meta : { title : 'uploadExcel' } }
240
237
]
241
238
} ,
242
239
@@ -246,27 +243,27 @@ export const asyncRouterMap = [
246
243
redirect : '/zip/download' ,
247
244
alwaysShow : true ,
248
245
meta : { title : 'zip' , icon : 'zip' } ,
249
- children : [ { path : 'download' , component : _import ( ' zip/index') , name : 'exportZip' , meta : { title : 'exportZip' } } ]
246
+ children : [ { path : 'download' , component : ( ) => import ( '@/views/ zip/index') , name : 'exportZip' , meta : { title : 'exportZip' } } ]
250
247
} ,
251
248
252
249
{
253
250
path : '/theme' ,
254
251
component : Layout ,
255
252
redirect : 'noredirect' ,
256
- children : [ { path : 'index' , component : _import ( ' theme/index') , name : 'theme' , meta : { title : 'theme' , icon : 'theme' } } ]
253
+ children : [ { path : 'index' , component : ( ) => import ( '@/views/ theme/index') , name : 'theme' , meta : { title : 'theme' , icon : 'theme' } } ]
257
254
} ,
258
255
259
256
{
260
257
path : '/clipboard' ,
261
258
component : Layout ,
262
259
redirect : 'noredirect' ,
263
- children : [ { path : 'index' , component : _import ( ' clipboard/index') , name : 'clipboardDemo' , meta : { title : 'clipboardDemo' , icon : 'clipboard' } } ]
260
+ children : [ { path : 'index' , component : ( ) => import ( '@/views/ clipboard/index') , name : 'clipboardDemo' , meta : { title : 'clipboardDemo' , icon : 'clipboard' } } ]
264
261
} ,
265
262
266
263
{
267
264
path : '/i18n' ,
268
265
component : Layout ,
269
- children : [ { path : 'index' , component : _import ( ' i18n-demo/index') , name : 'i18n' , meta : { title : 'i18n' , icon : 'international' } } ]
266
+ children : [ { path : 'index' , component : ( ) => import ( '@/views/ i18n-demo/index') , name : 'i18n' , meta : { title : 'i18n' , icon : 'international' } } ]
270
267
} ,
271
268
272
269
{ path : '*' , redirect : '/404' , hidden : true }
0 commit comments