2017-08-22 07:43:34 +00:00
|
|
|
import Vue from 'vue'
|
|
|
|
import Router from 'vue-router'
|
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-11-17 06:57:39 +00:00
|
|
|
/* Layout */
|
2018-05-31 08:53:08 +00:00
|
|
|
import Layout from '@/views/layout/Layout'
|
2017-05-17 08:26:33 +00:00
|
|
|
|
2017-12-29 08:07:42 +00:00
|
|
|
/** note: submenu only apppear when children.length>=1
|
2018-06-25 06:54:02 +00:00
|
|
|
* detail see https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
|
2017-12-29 08:07:42 +00:00
|
|
|
**/
|
|
|
|
|
2017-07-28 07:12:32 +00:00
|
|
|
/**
|
2017-11-17 06:57:39 +00:00
|
|
|
* hidden: true if `hidden:true` will not show in the sidebar(default is false)
|
2018-01-24 06:47:20 +00:00
|
|
|
* alwaysShow: true if set true, will always show the root menu, whatever its child routes length
|
|
|
|
* if not set alwaysShow, only more than one route under the children
|
|
|
|
* it will becomes nested mode, otherwise not show the root menu
|
2017-11-17 06:57:39 +00:00
|
|
|
* redirect: noredirect if `redirect:noredirect` will no redirct in the breadcrumb
|
|
|
|
* name:'router-name' the name is used by <keep-alive> (must set!!!)
|
2017-10-31 02:49:24 +00:00
|
|
|
* meta : {
|
2018-01-05 03:38:34 +00:00
|
|
|
roles: ['admin','editor'] will control the page roles (you can set multiple roles)
|
2017-11-17 06:57:39 +00:00
|
|
|
title: 'title' the name show in submenu and breadcrumb (recommend set)
|
|
|
|
icon: 'svg-name' the icon show in the sidebar,
|
2018-02-27 02:21:53 +00:00
|
|
|
noCache: true if true ,the page will no be cached(default is false)
|
2017-10-31 02:49:24 +00:00
|
|
|
}
|
2017-07-28 07:12:32 +00:00
|
|
|
**/
|
2017-05-17 08:26:33 +00:00
|
|
|
export const constantRouterMap = [
|
2018-05-31 08:53:08 +00:00
|
|
|
{ path: '/login', component: () => import('@/views/login/index'), hidden: true },
|
|
|
|
{ path: '/authredirect', component: () => import('@/views/login/authredirect'), hidden: true },
|
|
|
|
{ path: '/404', component: () => import('@/views/errorPage/404'), hidden: true },
|
|
|
|
{ path: '/401', component: () => import('@/views/errorPage/401'), hidden: true },
|
2017-05-17 08:26:33 +00:00
|
|
|
{
|
2017-11-02 09:58:35 +00:00
|
|
|
path: '',
|
2017-05-17 08:26:33 +00:00
|
|
|
component: Layout,
|
2017-11-02 09:58:35 +00:00
|
|
|
redirect: 'dashboard',
|
2017-10-26 10:27:39 +00:00
|
|
|
children: [{
|
|
|
|
path: 'dashboard',
|
2018-05-31 08:53:08 +00:00
|
|
|
component: () => import('@/views/dashboard/index'),
|
2017-10-26 10:27:39 +00:00
|
|
|
name: 'dashboard',
|
2017-11-22 02:01:53 +00:00
|
|
|
meta: { title: 'dashboard', icon: 'dashboard', noCache: true }
|
2017-10-26 10:27:39 +00:00
|
|
|
}]
|
2017-05-17 08:26:33 +00:00
|
|
|
},
|
|
|
|
{
|
2017-11-17 06:57:39 +00:00
|
|
|
path: '/documentation',
|
2017-05-17 08:26:33 +00:00
|
|
|
component: Layout,
|
2017-11-17 06:57:39 +00:00
|
|
|
redirect: '/documentation/index',
|
2017-10-26 10:27:39 +00:00
|
|
|
children: [{
|
|
|
|
path: 'index',
|
2018-05-31 08:53:08 +00:00
|
|
|
component: () => import('@/views/documentation/index'),
|
2017-11-17 06:57:39 +00:00
|
|
|
name: 'documentation',
|
|
|
|
meta: { title: 'documentation', icon: 'documentation', noCache: true }
|
2017-10-26 10:27:39 +00:00
|
|
|
}]
|
2018-05-28 06:36:06 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/guide',
|
|
|
|
component: Layout,
|
|
|
|
redirect: '/guide/index',
|
|
|
|
children: [{
|
|
|
|
path: 'index',
|
2018-05-31 08:53:08 +00:00
|
|
|
component: () => import('@/views/guide/index'),
|
2018-05-28 06:36:06 +00:00
|
|
|
name: 'guide',
|
|
|
|
meta: { title: 'guide', icon: 'guide', noCache: true }
|
|
|
|
}]
|
2017-05-17 08:26:33 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
|
|
|
|
export default new Router({
|
2018-01-05 03:38:34 +00:00
|
|
|
// mode: 'history', // require service support
|
2017-05-17 08:26:33 +00:00
|
|
|
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',
|
2018-05-08 14:15:34 +00:00
|
|
|
alwaysShow: true, // will always show the root menu
|
|
|
|
meta: {
|
|
|
|
title: 'permission',
|
|
|
|
icon: 'lock',
|
|
|
|
roles: ['admin', 'editor'] // you can set roles in root nav
|
|
|
|
},
|
2017-10-26 10:27:39 +00:00
|
|
|
children: [{
|
2018-05-08 14:15:34 +00:00
|
|
|
path: 'page',
|
2018-05-31 08:53:08 +00:00
|
|
|
component: () => import('@/views/permission/page'),
|
2018-05-08 14:15:34 +00:00
|
|
|
name: 'pagePermission',
|
2017-10-26 10:27:39 +00:00
|
|
|
meta: {
|
2018-05-08 14:15:34 +00:00
|
|
|
title: 'pagePermission',
|
2018-01-05 03:38:34 +00:00
|
|
|
roles: ['admin'] // or you can only set roles in sub nav
|
2017-10-26 10:27:39 +00:00
|
|
|
}
|
2018-05-08 14:15:34 +00:00
|
|
|
}, {
|
|
|
|
path: 'directive',
|
2018-05-31 08:53:08 +00:00
|
|
|
component: () => import('@/views/permission/directive'),
|
2018-05-08 14:15:34 +00:00
|
|
|
name: 'directivePermission',
|
|
|
|
meta: {
|
|
|
|
title: 'directivePermission'
|
|
|
|
// if do not set roles, means: this page does not require permission
|
|
|
|
}
|
2017-10-26 10:27:39 +00:00
|
|
|
}]
|
2017-05-17 08:26:33 +00:00
|
|
|
},
|
2017-10-26 10:27:39 +00:00
|
|
|
|
2017-08-29 09:53:41 +00:00
|
|
|
{
|
|
|
|
path: '/icon',
|
|
|
|
component: Layout,
|
2017-10-26 10:27:39 +00:00
|
|
|
children: [{
|
|
|
|
path: 'index',
|
2018-05-31 08:53:08 +00:00
|
|
|
component: () => import('@/views/svg-icons/index'),
|
2017-10-26 10:27:39 +00:00
|
|
|
name: 'icons',
|
2017-11-17 06:57:39 +00:00
|
|
|
meta: { title: 'icons', icon: 'icon', noCache: true }
|
2017-10-26 10:27:39 +00:00
|
|
|
}]
|
2017-08-29 09:53:41 +00:00
|
|
|
},
|
2017-10-26 10:27:39 +00:00
|
|
|
|
2017-05-17 08:26:33 +00:00
|
|
|
{
|
|
|
|
path: '/components',
|
|
|
|
component: Layout,
|
2017-11-24 07:35:38 +00:00
|
|
|
redirect: 'noredirect',
|
2017-11-17 09:51:41 +00:00
|
|
|
name: 'component-demo',
|
2017-10-26 10:27:39 +00:00
|
|
|
meta: {
|
2017-11-03 10:37:49 +00:00
|
|
|
title: 'components',
|
2017-10-26 10:27:39 +00:00
|
|
|
icon: 'component'
|
|
|
|
},
|
2017-05-17 08:26:33 +00:00
|
|
|
children: [
|
2018-05-31 08:53:08 +00:00
|
|
|
{ path: 'tinymce', component: () => import('@/views/components-demo/tinymce'), name: 'tinymce-demo', meta: { title: 'tinymce' }},
|
|
|
|
{ path: 'markdown', component: () => import('@/views/components-demo/markdown'), name: 'markdown-demo', meta: { title: 'markdown' }},
|
|
|
|
{ path: 'json-editor', component: () => import('@/views/components-demo/jsonEditor'), name: 'jsonEditor-demo', meta: { title: 'jsonEditor' }},
|
|
|
|
{ path: 'splitpane', component: () => import('@/views/components-demo/splitpane'), name: 'splitpane-demo', meta: { title: 'splitPane' }},
|
|
|
|
{ path: 'avatar-upload', component: () => import('@/views/components-demo/avatarUpload'), name: 'avatarUpload-demo', meta: { title: 'avatarUpload' }},
|
|
|
|
{ path: 'dropzone', component: () => import('@/views/components-demo/dropzone'), name: 'dropzone-demo', meta: { title: 'dropzone' }},
|
|
|
|
{ path: 'sticky', component: () => import('@/views/components-demo/sticky'), name: 'sticky-demo', meta: { title: 'sticky' }},
|
|
|
|
{ path: 'count-to', component: () => import('@/views/components-demo/countTo'), name: 'countTo-demo', meta: { title: 'countTo' }},
|
|
|
|
{ path: 'mixin', component: () => import('@/views/components-demo/mixin'), name: 'componentMixin-demo', meta: { title: 'componentMixin' }},
|
|
|
|
{ path: 'back-to-top', component: () => import('@/views/components-demo/backToTop'), name: 'backToTop-demo', meta: { title: 'backToTop' }},
|
|
|
|
{ path: 'drag-dialog', component: () => import('@/views/components-demo/dragDialog'), name: 'dragDialog-demo', meta: { title: 'dragDialog' }},
|
|
|
|
{ path: 'dnd-list', component: () => import('@/views/components-demo/dndList'), name: 'dndList-demo', meta: { title: 'dndList' }},
|
|
|
|
{ path: 'drag-kanban', component: () => import('@/views/components-demo/dragKanban'), name: 'dragKanban-demo', meta: { title: 'dragKanban' }}
|
2017-05-17 08:26:33 +00:00
|
|
|
]
|
|
|
|
},
|
2017-10-26 10:27:39 +00:00
|
|
|
|
2017-05-17 08:26:33 +00:00
|
|
|
{
|
|
|
|
path: '/charts',
|
|
|
|
component: Layout,
|
2017-11-24 07:35:38 +00:00
|
|
|
redirect: 'noredirect',
|
2017-10-26 10:27:39 +00:00
|
|
|
name: 'charts',
|
|
|
|
meta: {
|
2017-11-03 10:37:49 +00:00
|
|
|
title: 'charts',
|
2017-10-26 10:27:39 +00:00
|
|
|
icon: 'chart'
|
|
|
|
},
|
2017-05-17 08:26:33 +00:00
|
|
|
children: [
|
2018-05-31 08:53:08 +00:00
|
|
|
{ path: 'keyboard', component: () => import('@/views/charts/keyboard'), name: 'keyboardChart', meta: { title: 'keyboardChart', noCache: true }},
|
|
|
|
{ path: 'line', component: () => import('@/views/charts/line'), name: 'lineChart', meta: { title: 'lineChart', noCache: true }},
|
|
|
|
{ path: 'mixchart', component: () => import('@/views/charts/mixChart'), name: 'mixChart', meta: { title: 'mixChart', noCache: true }}
|
2017-07-28 07:12:32 +00:00
|
|
|
]
|
|
|
|
},
|
2017-10-26 10:27:39 +00:00
|
|
|
|
2017-07-28 07:12:32 +00:00
|
|
|
{
|
2018-05-30 07:25:08 +00:00
|
|
|
path: '/tab',
|
2017-07-28 07:12:32 +00:00
|
|
|
component: Layout,
|
2018-05-30 07:25:08 +00:00
|
|
|
children: [{
|
|
|
|
path: 'index',
|
2018-05-31 08:53:08 +00:00
|
|
|
component: () => import('@/views/tab/index'),
|
2018-05-30 07:25:08 +00:00
|
|
|
name: 'tab',
|
|
|
|
meta: { title: 'tab', icon: 'tab' }
|
|
|
|
}]
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
path: '/table',
|
|
|
|
component: Layout,
|
|
|
|
redirect: '/table/complex-table',
|
|
|
|
name: 'table',
|
2017-10-26 10:27:39 +00:00
|
|
|
meta: {
|
2018-05-30 07:25:08 +00:00
|
|
|
title: 'Table',
|
|
|
|
icon: 'table'
|
2017-10-26 10:27:39 +00:00
|
|
|
},
|
2017-07-28 07:12:32 +00:00
|
|
|
children: [
|
2018-05-31 08:53:08 +00:00
|
|
|
{ path: 'dynamic-table', component: () => import('@/views/table/dynamicTable/index'), name: 'dynamicTable', meta: { title: 'dynamicTable' }},
|
|
|
|
{ path: 'drag-table', component: () => import('@/views/table/dragTable'), name: 'dragTable', meta: { title: 'dragTable' }},
|
|
|
|
{ path: 'inline-edit-table', component: () => import('@/views/table/inlineEditTable'), name: 'inlineEditTable', meta: { title: 'inlineEditTable' }},
|
|
|
|
{ path: 'tree-table', component: () => import('@/views/table/treeTable/treeTable'), name: 'treeTableDemo', meta: { title: 'treeTable' }},
|
|
|
|
{ path: 'custom-tree-table', component: () => import('@/views/table/treeTable/customTreeTable'), name: 'customTreeTableDemo', meta: { title: 'customTreeTable' }},
|
|
|
|
{ path: 'complex-table', component: () => import('@/views/table/complexTable'), name: 'complexTable', meta: { title: 'complexTable' }}
|
2017-10-31 02:49:24 +00:00
|
|
|
]
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
2018-05-30 07:25:08 +00:00
|
|
|
path: '/example',
|
2017-10-31 02:49:24 +00:00
|
|
|
component: Layout,
|
2018-05-30 07:25:08 +00:00
|
|
|
redirect: '/example/list',
|
|
|
|
name: 'example',
|
2017-10-31 02:49:24 +00:00
|
|
|
meta: {
|
2018-05-30 07:25:08 +00:00
|
|
|
title: 'example',
|
|
|
|
icon: 'example'
|
2017-10-31 02:49:24 +00:00
|
|
|
},
|
|
|
|
children: [
|
2018-05-31 08:53:08 +00:00
|
|
|
{ path: 'create', component: () => import('@/views/example/create'), name: 'createArticle', meta: { title: 'createArticle', icon: 'edit' }},
|
|
|
|
{ path: 'edit/:id(\\d+)', component: () => import('@/views/example/edit'), name: 'editArticle', meta: { title: 'editArticle', noCache: true }, hidden: true },
|
|
|
|
{ path: 'list', component: () => import('@/views/example/list'), name: 'articleList', meta: { title: 'articleList', icon: 'list' }}
|
2017-05-17 08:26:33 +00:00
|
|
|
]
|
|
|
|
},
|
2017-10-26 10:27:39 +00:00
|
|
|
|
2018-06-21 06:26:25 +00:00
|
|
|
{
|
|
|
|
path: '/nested',
|
|
|
|
component: Layout,
|
2018-07-13 03:23:06 +00:00
|
|
|
redirect: '/nested/menu1',
|
2018-06-21 06:26:25 +00:00
|
|
|
name: 'nested',
|
|
|
|
meta: {
|
|
|
|
title: 'nested',
|
|
|
|
icon: 'nested'
|
|
|
|
},
|
|
|
|
children: [
|
|
|
|
{
|
2018-07-13 03:23:06 +00:00
|
|
|
path: 'menu1',
|
|
|
|
component: () => import('@/views/nested/menu1/index'), // Parent router-view
|
|
|
|
name: 'menu1',
|
|
|
|
meta: { title: 'menu1' },
|
2018-06-21 06:26:25 +00:00
|
|
|
children: [
|
|
|
|
{
|
2018-07-13 03:23:06 +00:00
|
|
|
path: 'menu1-1',
|
|
|
|
component: () => import('@/views/nested/menu1/menu1-1'),
|
|
|
|
name: 'menu1-1',
|
|
|
|
meta: { title: 'menu1-1' }
|
2018-06-21 06:26:25 +00:00
|
|
|
},
|
|
|
|
{
|
2018-07-13 03:23:06 +00:00
|
|
|
path: 'menu1-2',
|
|
|
|
component: () => import('@/views/nested/menu1/menu1-2'),
|
|
|
|
name: 'menu1-2',
|
|
|
|
meta: { title: 'menu1-2' },
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
path: 'menu1-2-1',
|
|
|
|
component: () => import('@/views/nested/menu1/menu1-2/menu1-2-1'),
|
|
|
|
name: 'menu1-2-1',
|
|
|
|
meta: { title: 'menu1-2-1' }
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: 'menu1-2-2',
|
|
|
|
component: () => import('@/views/nested/menu1/menu1-2/menu1-2-2'),
|
|
|
|
name: 'menu1-2-2',
|
|
|
|
meta: { title: 'menu1-2-2' }
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: 'menu1-3',
|
|
|
|
component: () => import('@/views/nested/menu1/menu1-3'),
|
|
|
|
name: 'menu1-3',
|
|
|
|
meta: { title: 'menu1-3' }
|
2018-06-21 06:26:25 +00:00
|
|
|
}
|
|
|
|
]
|
2018-07-13 03:23:06 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: 'menu2',
|
|
|
|
component: () => import('@/views/nested/menu2/index'),
|
|
|
|
meta: { title: 'menu2' }
|
2018-06-21 06:26:25 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
|
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',
|
2017-10-26 10:27:39 +00:00
|
|
|
name: 'errorPages',
|
|
|
|
meta: {
|
2017-11-03 10:37:49 +00:00
|
|
|
title: 'errorPages',
|
2017-10-26 10:27:39 +00:00
|
|
|
icon: '404'
|
|
|
|
},
|
2017-05-17 08:26:33 +00:00
|
|
|
children: [
|
2018-05-31 08:53:08 +00:00
|
|
|
{ path: '401', component: () => import('@/views/errorPage/401'), name: 'page401', meta: { title: 'page401', noCache: true }},
|
|
|
|
{ path: '404', component: () => import('@/views/errorPage/404'), name: 'page404', meta: { title: 'page404', noCache: true }}
|
2017-05-17 08:26:33 +00:00
|
|
|
]
|
|
|
|
},
|
2017-10-26 10:27:39 +00:00
|
|
|
|
2017-05-17 08:26:33 +00:00
|
|
|
{
|
2017-10-26 10:27:39 +00:00
|
|
|
path: '/error-log',
|
2017-05-17 08:26:33 +00:00
|
|
|
component: Layout,
|
|
|
|
redirect: 'noredirect',
|
2018-05-31 08:53:08 +00:00
|
|
|
children: [{ path: 'log', component: () => import('@/views/errorLog/index'), name: 'errorLog', meta: { title: 'errorLog', icon: 'bug' }}]
|
2017-05-17 08:26:33 +00:00
|
|
|
},
|
2017-10-26 10:27:39 +00:00
|
|
|
|
2017-05-17 08:26:33 +00:00
|
|
|
{
|
|
|
|
path: '/excel',
|
|
|
|
component: Layout,
|
2017-11-24 07:35:38 +00:00
|
|
|
redirect: '/excel/export-excel',
|
2017-05-17 08:26:33 +00:00
|
|
|
name: 'excel',
|
2017-10-26 10:27:39 +00:00
|
|
|
meta: {
|
|
|
|
title: 'excel',
|
|
|
|
icon: 'excel'
|
|
|
|
},
|
2017-07-25 08:51:43 +00:00
|
|
|
children: [
|
2018-05-31 08:53:08 +00:00
|
|
|
{ path: 'export-excel', component: () => import('@/views/excel/exportExcel'), name: 'exportExcel', meta: { title: 'exportExcel' }},
|
|
|
|
{ path: 'export-selected-excel', component: () => import('@/views/excel/selectExcel'), name: 'selectExcel', meta: { title: 'selectExcel' }},
|
|
|
|
{ path: 'upload-excel', component: () => import('@/views/excel/uploadExcel'), name: 'uploadExcel', meta: { title: 'uploadExcel' }}
|
2017-07-25 08:51:43 +00:00
|
|
|
]
|
2017-05-17 08:26:33 +00:00
|
|
|
},
|
2017-10-26 10:27:39 +00:00
|
|
|
|
2017-09-26 05:40:07 +00:00
|
|
|
{
|
|
|
|
path: '/zip',
|
|
|
|
component: Layout,
|
|
|
|
redirect: '/zip/download',
|
2018-01-24 06:47:20 +00:00
|
|
|
alwaysShow: true,
|
|
|
|
meta: { title: 'zip', icon: 'zip' },
|
2018-05-31 08:53:08 +00:00
|
|
|
children: [{ path: 'download', component: () => import('@/views/zip/index'), name: 'exportZip', meta: { title: 'exportZip' }}]
|
2017-09-26 05:40:07 +00:00
|
|
|
},
|
2017-10-26 10:27:39 +00:00
|
|
|
|
2017-05-17 08:26:33 +00:00
|
|
|
{
|
|
|
|
path: '/theme',
|
|
|
|
component: Layout,
|
|
|
|
redirect: 'noredirect',
|
2018-05-31 08:53:08 +00:00
|
|
|
children: [{ path: 'index', component: () => import('@/views/theme/index'), name: 'theme', meta: { title: 'theme', icon: 'theme' }}]
|
2017-05-17 08:26:33 +00:00
|
|
|
},
|
2017-10-26 10:27:39 +00:00
|
|
|
|
2017-09-27 02:03:42 +00:00
|
|
|
{
|
|
|
|
path: '/clipboard',
|
|
|
|
component: Layout,
|
|
|
|
redirect: 'noredirect',
|
2018-05-31 08:53:08 +00:00
|
|
|
children: [{ path: 'index', component: () => import('@/views/clipboard/index'), name: 'clipboardDemo', meta: { title: 'clipboardDemo', icon: 'clipboard' }}]
|
2017-11-03 10:37:49 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
path: '/i18n',
|
|
|
|
component: Layout,
|
2018-05-31 08:53:08 +00:00
|
|
|
children: [{ path: 'index', component: () => import('@/views/i18n-demo/index'), name: 'i18n', meta: { title: 'i18n', icon: 'international' }}]
|
2017-09-27 02:03:42 +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
|
|
|
]
|