@@ -70,49 +70,56 @@ Vue.use(Router);
7070 * noDropdown : if noDropdown:true will not has submenu
7171 * meta : { role: ['admin'] } will control the page role
7272 */
73- export default new Router ( {
74- // mode: 'history', //后端支持可开
75- scrollBehavior : ( ) => ( { y : 0 } ) ,
76- routes : [
73+
74+ export const constantRouterMap = [
7775 { path : '/login' , component : Login , hidden : true } ,
7876 { path : '/authredirect' , component : authRedirect , hidden : true } ,
7977 { path : '/sendpwd' , component : sendPWD , hidden : true } ,
8078 { path : '/reset' , component : reset , hidden : true } ,
8179 { path : '/404' , component : Err404 , hidden : true } ,
8280 { path : '/401' , component : Err401 , hidden : true } ,
83- {
84- path : '/' ,
85- component : Layout ,
86- redirect : '/dashboard' ,
87- name : '首页' ,
88- hidden : true ,
89- children : [ { path : 'dashboard' , component : dashboard } ]
90- } ,
91- {
92- path : '/introduction' ,
93- component : Layout ,
94- redirect : '/introduction/index' ,
95- icon : 'xinrenzhinan' ,
96- noDropdown : true ,
97- children : [ { path : 'index' , component : Introduction , name : '简述' } ]
98- } ,
99- {
100- path : '/permission' ,
101- component : Layout ,
102- redirect : '/permission/index' ,
103- name : '权限测试' ,
104- icon : 'quanxian' ,
105- meta : { role : [ 'admin' ] } ,
106- noDropdown : true ,
107- children : [ { path : 'index' , component : Permission , name : '权限测试页' , meta : { role : [ 'admin' ] } } ]
108- } ,
109- {
110- path : '/components' ,
111- component : Layout ,
112- redirect : '/components/index' ,
113- name : '组件' ,
114- icon : 'zujian' ,
115- children : [
81+ {
82+ path : '/' ,
83+ component : Layout ,
84+ redirect : '/dashboard' ,
85+ name : '首页' ,
86+ hidden : true ,
87+ children : [ { path : 'dashboard' , component : dashboard } ]
88+ } ,
89+ {
90+ path : '/introduction' ,
91+ component : Layout ,
92+ redirect : '/introduction/index' ,
93+ icon : 'xinrenzhinan' ,
94+ noDropdown : true ,
95+ children : [ { path : 'index' , component : Introduction , name : '简述' } ]
96+ }
97+ ]
98+
99+ export default new Router ( {
100+ // mode: 'history', //后端支持可开
101+ scrollBehavior : ( ) => ( { y : 0 } ) ,
102+ routes : constantRouterMap
103+ } ) ;
104+
105+ export const asyncRouterMap = [
106+ {
107+ path : '/permission' ,
108+ component : Layout ,
109+ redirect : '/permission/index' ,
110+ name : '权限测试' ,
111+ icon : 'quanxian' ,
112+ meta : { role : [ 'admin' ] } ,
113+ noDropdown : true ,
114+ children : [ { path : 'index' , component : Permission , name : '权限测试页' , meta : { role : [ 'admin' ] } } ]
115+ } ,
116+ {
117+ path : '/components' ,
118+ component : Layout ,
119+ redirect : '/components/index' ,
120+ name : '组件' ,
121+ icon : 'zujian' ,
122+ children : [
116123 { path : 'index' , component : componentsIndex , name : '介绍 ' } ,
117124 { path : 'tinymce' , component : Tinymce , name : '富文本编辑器' } ,
118125 { path : 'markdown' , component : Markdown , name : 'Markdown' } ,
@@ -124,75 +131,73 @@ export default new Router({
124131 { path : 'sticky' , component : Sticky , name : 'Sticky' } ,
125132 { path : 'countto' , component : CountTo , name : 'CountTo' } ,
126133 { path : 'mixin' , component : Mixin , name : '小组件' }
127- ]
128- } ,
129- {
130- path : '/charts' ,
131- component : Layout ,
132- redirect : '/charts/index' ,
133- name : '图表' ,
134- icon : 'tubiaoleixingzhengchang' ,
135- children : [
134+ ]
135+ } ,
136+ {
137+ path : '/charts' ,
138+ component : Layout ,
139+ redirect : '/charts/index' ,
140+ name : '图表' ,
141+ icon : 'tubiaoleixingzhengchang' ,
142+ children : [
136143 { path : 'index' , component : chartIndex , name : '介绍' } ,
137144 { path : 'keyboard' , component : KeyboardChart , name : '键盘图表' } ,
138145 { path : 'keyboard2' , component : KeyboardChart2 , name : '键盘图表2' } ,
139146 { path : 'line' , component : LineMarker , name : '折线图' } ,
140147 { path : 'mixchart' , component : MixChart , name : '混合图表' }
141- ]
142- } ,
143- {
144- path : '/errorpage' ,
145- component : Layout ,
146- redirect : 'noredirect' ,
147- name : '错误页面' ,
148- icon : '404' ,
149- children : [
148+ ]
149+ } ,
150+ {
151+ path : '/errorpage' ,
152+ component : Layout ,
153+ redirect : 'noredirect' ,
154+ name : '错误页面' ,
155+ icon : '404' ,
156+ children : [
150157 { path : '401' , component : Err401 , name : '401' } ,
151158 { path : '404' , component : Err404 , name : '404' }
152- ]
153- } ,
154- {
155- path : '/errlog' ,
156- component : Layout ,
157- redirect : 'noredirect' ,
158- name : 'errlog' ,
159- icon : 'bug' ,
160- noDropdown : true ,
161- children : [ { path : 'log' , component : ErrorLog , name : '错误日志' } ]
162- } ,
163- {
164- path : '/excel' ,
165- component : Layout ,
166- redirect : 'noredirect' ,
167- name : 'excel' ,
168- icon : 'EXCEL' ,
169- noDropdown : true ,
170- children : [ { path : 'download' , component : ExcelDownload , name : '导出excel' } ]
171- } ,
172- {
173- path : '/theme' ,
174- component : Layout ,
175- redirect : 'noredirect' ,
176- name : 'theme' ,
177- icon : 'theme' ,
178- noDropdown : true ,
179- children : [ { path : 'index' , component : Theme , name : '换肤' } ]
180- } ,
181- {
182- path : '/example' ,
183- component : Layout ,
184- redirect : 'noredirect' ,
185- name : '综合实例' ,
186- icon : 'zonghe' ,
187- children : [
159+ ]
160+ } ,
161+ {
162+ path : '/errlog' ,
163+ component : Layout ,
164+ redirect : 'noredirect' ,
165+ name : 'errlog' ,
166+ icon : 'bug' ,
167+ noDropdown : true ,
168+ children : [ { path : 'log' , component : ErrorLog , name : '错误日志' } ]
169+ } ,
170+ {
171+ path : '/excel' ,
172+ component : Layout ,
173+ redirect : 'noredirect' ,
174+ name : 'excel' ,
175+ icon : 'EXCEL' ,
176+ noDropdown : true ,
177+ children : [ { path : 'download' , component : ExcelDownload , name : '导出excel' } ]
178+ } ,
179+ {
180+ path : '/theme' ,
181+ component : Layout ,
182+ redirect : 'noredirect' ,
183+ name : 'theme' ,
184+ icon : 'theme' ,
185+ noDropdown : true ,
186+ children : [ { path : 'index' , component : Theme , name : '换肤' } ]
187+ } ,
188+ {
189+ path : '/example' ,
190+ component : Layout ,
191+ redirect : 'noredirect' ,
192+ name : '综合实例' ,
193+ icon : 'zonghe' ,
194+ children : [
188195 { path : 'dynamictable' , component : DynamicTable , name : '动态table' } ,
189196 { path : 'dragtable' , component : DragTable , name : '拖拽table' } ,
190197 { path : 'inline_edit_table' , component : InlineEditTable , name : 'table内编辑' } ,
191198 { path : 'table' , component : Table , name : '综合table' } ,
192199 { path : 'form1' , component : Form1 , name : '综合form1' }
193- ]
194- } ,
195-
196- { path : '*' , redirect : '/404' , hidden : true }
197- ]
198- } ) ;
200+ ]
201+ } ,
202+ { path : '*' , redirect : '/404' , hidden : true }
203+ ] ;
0 commit comments