2017-08-22 07:43:34 +00:00
import Vue from 'vue'
import Router from 'vue-router'
const _import = require ( './_import_' + process . env . NODE _ENV )
2017-08-28 14:59:09 +00:00
// 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
2017-04-18 07:09:13 +00:00
2017-08-22 07:43:34 +00:00
Vue . use ( Router )
2017-04-18 07:09:13 +00:00
2017-07-28 07:12:32 +00:00
/* layout */
2017-08-22 07:43:34 +00:00
import Layout from '../views/layout/Layout'
2017-05-17 08:26:33 +00:00
2017-07-28 07:12:32 +00:00
/ * *
* icon : the icon show in the sidebar
* hidden : if ` hidden:true ` will not show in the sidebar
* redirect : if ` redirect:noredirect ` will no redirct in the levelbar
* noDropdown : if ` noDropdown:true ` will has no submenu
* meta : { role : [ 'admin' ] } will control the page role
* * /
2017-05-17 08:26:33 +00:00
export const constantRouterMap = [
2017-07-28 07:12:32 +00:00
{ path : '/login' , component : _import ( 'login/index' ) , hidden : true } ,
{ path : '/authredirect' , component : _import ( 'login/authredirect' ) , hidden : true } ,
2017-08-22 10:47:23 +00:00
{ path : '/404' , component : _import ( 'errorPage/404' ) , hidden : true } ,
{ path : '/401' , component : _import ( 'errorPage/401' ) , hidden : true } ,
2017-05-17 08:26:33 +00:00
{
path : '/' ,
component : Layout ,
redirect : '/dashboard' ,
name : '首页' ,
hidden : true ,
2017-07-28 07:12:32 +00:00
children : [ { path : 'dashboard' , component : _import ( 'dashboard/index' ) } ]
2017-05-17 08:26:33 +00:00
} ,
{
path : '/introduction' ,
component : Layout ,
redirect : '/introduction/index' ,
icon : 'xinrenzhinan' ,
noDropdown : true ,
2017-07-28 07:12:32 +00:00
children : [ { path : 'index' , component : _import ( 'introduction/index' ) , name : '简述' } ]
2017-05-17 08:26:33 +00:00
}
]
export default new Router ( {
// mode: 'history', //后端支持可开
scrollBehavior : ( ) => ( { y : 0 } ) ,
routes : constantRouterMap
2017-08-22 07:43:34 +00:00
} )
2017-05-17 08:26:33 +00:00
export const asyncRouterMap = [
{
path : '/permission' ,
component : Layout ,
redirect : '/permission/index' ,
name : '权限测试' ,
icon : 'quanxian' ,
meta : { role : [ 'admin' ] } ,
noDropdown : true ,
2017-08-22 07:43:34 +00:00
children : [ { path : 'index' , component : _import ( 'permission/index' ) , name : '权限测试页' , meta : { role : [ 'admin' ] } } ]
2017-05-17 08:26:33 +00:00
} ,
2017-08-29 09:53:41 +00:00
{
path : '/icon' ,
component : Layout ,
icon : 'icons' ,
noDropdown : true ,
children : [ { path : 'index' , component : _import ( 'svg-icons/index' ) , name : 'icons' } ]
} ,
2017-05-17 08:26:33 +00:00
{
path : '/components' ,
component : Layout ,
redirect : '/components/index' ,
name : '组件' ,
icon : 'zujian' ,
children : [
2017-07-28 07:12:32 +00:00
{ path : 'index' , component : _import ( 'components/index' ) , name : '介绍 ' } ,
{ path : 'tinymce' , component : _import ( 'components/tinymce' ) , name : '富文本编辑器' } ,
{ path : 'markdown' , component : _import ( 'components/markdown' ) , name : 'Markdown' } ,
2017-08-23 03:16:54 +00:00
{ path : 'jsoneditor' , component : _import ( 'components/jsonEditor' ) , name : 'JSON编辑器' } ,
{ path : 'dndlist' , component : _import ( 'components/dndList' ) , name : '列表拖拽' } ,
2017-07-28 07:12:32 +00:00
{ path : 'splitpane' , component : _import ( 'components/splitpane' ) , name : 'SplitPane' } ,
{ path : 'avatarupload' , component : _import ( 'components/avatarUpload' ) , name : '头像上传' } ,
{ path : 'dropzone' , component : _import ( 'components/dropzone' ) , name : 'Dropzone' } ,
{ path : 'sticky' , component : _import ( 'components/sticky' ) , name : 'Sticky' } ,
{ path : 'countto' , component : _import ( 'components/countTo' ) , name : 'CountTo' } ,
{ path : 'mixin' , component : _import ( 'components/mixin' ) , name : '小组件' } ,
{ path : 'backtotop' , component : _import ( 'components/backToTop' ) , name : '返回顶部' }
2017-05-17 08:26:33 +00:00
]
} ,
{
path : '/charts' ,
component : Layout ,
redirect : '/charts/index' ,
name : '图表' ,
2017-08-29 08:28:28 +00:00
icon : 'tubiao' ,
2017-05-17 08:26:33 +00:00
children : [
2017-07-28 07:12:32 +00:00
{ path : 'index' , component : _import ( 'charts/index' ) , name : '介绍' } ,
{ path : 'keyboard' , component : _import ( 'charts/keyboard' ) , name : '键盘图表' } ,
{ path : 'keyboard2' , component : _import ( 'charts/keyboard2' ) , name : '键盘图表2' } ,
{ path : 'line' , component : _import ( 'charts/line' ) , name : '折线图' } ,
{ path : 'mixchart' , component : _import ( 'charts/mixChart' ) , name : '混合图表' }
]
} ,
{
path : '/example' ,
component : Layout ,
redirect : 'noredirect' ,
name : '综合实例' ,
icon : 'zonghe' ,
children : [
{
path : '/example/table' ,
component : _import ( 'example/table/index' ) ,
redirect : '/example/table/table' ,
name : 'Table' ,
icon : 'table' ,
children : [
2017-08-28 05:12:44 +00:00
{ path : 'dynamictable' , component : _import ( 'example/table/dynamictable/index' ) , name : '动态table' } ,
2017-07-28 07:12:32 +00:00
{ path : 'dragtable' , component : _import ( 'example/table/dragTable' ) , name : '拖拽table' } ,
{ path : 'inline_edit_table' , component : _import ( 'example/table/inlineEditTable' ) , name : 'table内编辑' } ,
{ path : 'table' , component : _import ( 'example/table/table' ) , name : '综合table' }
]
} ,
2017-08-29 08:28:28 +00:00
{ path : 'form/edit' , icon : 'shouce' , component : _import ( 'example/form' ) , name : '编辑Form' , meta : { isEdit : true } } ,
{ path : 'form/create' , icon : 'from' , component : _import ( 'example/form' ) , name : '创建Form' } ,
{ path : 'tab/index' , icon : 'tab' , component : _import ( 'example/tab/index' ) , name : 'Tab' }
2017-05-17 08:26:33 +00:00
]
} ,
{
2017-08-22 10:47:23 +00:00
path : '/error' ,
2017-05-17 08:26:33 +00:00
component : Layout ,
redirect : 'noredirect' ,
name : '错误页面' ,
icon : '404' ,
children : [
2017-08-22 10:47:23 +00:00
{ path : '401' , component : _import ( 'errorPage/401' ) , name : '401' } ,
{ path : '404' , component : _import ( 'errorPage/404' ) , name : '404' }
2017-05-17 08:26:33 +00:00
]
} ,
{
path : '/errlog' ,
component : Layout ,
redirect : 'noredirect' ,
name : 'errlog' ,
icon : 'bug' ,
noDropdown : true ,
2017-07-28 07:12:32 +00:00
children : [ { path : 'log' , component : _import ( 'errlog/index' ) , name : '错误日志' } ]
2017-05-17 08:26:33 +00:00
} ,
{
path : '/excel' ,
component : Layout ,
2017-08-22 10:47:23 +00:00
redirect : '/excel/download' ,
2017-05-17 08:26:33 +00:00
name : 'excel' ,
icon : 'EXCEL' ,
2017-07-25 08:51:43 +00:00
children : [
2017-07-28 07:12:32 +00:00
{ path : 'download' , component : _import ( 'excel/index' ) , name : '导出excel' } ,
2017-08-22 10:47:23 +00:00
{ path : 'download2' , component : _import ( 'excel/selectExcel' ) , name : '导出已选择项' }
2017-07-25 08:51:43 +00:00
]
2017-05-17 08:26:33 +00:00
} ,
{
path : '/theme' ,
component : Layout ,
redirect : 'noredirect' ,
name : 'theme' ,
icon : 'theme' ,
noDropdown : true ,
2017-07-28 07:12:32 +00:00
children : [ { path : 'index' , component : _import ( 'theme/index' ) , name : '换肤' } ]
2017-05-17 08:26:33 +00:00
} ,
2017-06-15 06:33:02 +00:00
2017-05-17 08:26:33 +00:00
{ path : '*' , redirect : '/404' , hidden : true }
2017-08-22 07:43:34 +00:00
]