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 */
|
2019-04-01 09:07:16 +00:00
|
|
|
import Layout from '@/layout'
|
2017-05-17 08:26:33 +00:00
|
|
|
|
2018-08-15 09:29:15 +00:00
|
|
|
/* Router Modules */
|
|
|
|
import componentsRouter from './modules/components'
|
|
|
|
import chartsRouter from './modules/charts'
|
|
|
|
import tableRouter from './modules/table'
|
|
|
|
import nestedRouter from './modules/nested'
|
|
|
|
|
2017-07-28 07:12:32 +00:00
|
|
|
/**
|
2019-04-08 04:58:33 +00:00
|
|
|
* Note: sub-menu only appear when route children.length >= 1
|
|
|
|
* Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
|
|
|
|
*
|
|
|
|
* hidden: true if set true, item will not show in the sidebar(default is false)
|
|
|
|
* alwaysShow: true if set true, will always show the root menu
|
|
|
|
* if not set alwaysShow, when item has more than one children route,
|
|
|
|
* it will becomes nested mode, otherwise not show the root menu
|
2019-04-16 05:51:14 +00:00
|
|
|
* redirect: noRedirect if set noRedirect will no redirect in the breadcrumb
|
2019-04-08 04:58:33 +00:00
|
|
|
* name:'router-name' the name is used by <keep-alive> (must set!!!)
|
|
|
|
* meta : {
|
|
|
|
roles: ['admin','editor'] control the page roles (you can set multiple roles)
|
|
|
|
title: 'title' the name show in sidebar and breadcrumb (recommend set)
|
2020-06-11 05:57:41 +00:00
|
|
|
icon: 'svg-name'/'el-icon-x' the icon show in the sidebar
|
2019-04-08 04:58:33 +00:00
|
|
|
noCache: true if set true, the page will no be cached(default is false)
|
|
|
|
affix: true if set true, the tag will affix in the tags-view
|
|
|
|
breadcrumb: false if set false, the item will hidden in breadcrumb(default is true)
|
|
|
|
activeMenu: '/example/list' if set path, the sidebar will highlight the path you set
|
2017-10-31 02:49:24 +00:00
|
|
|
}
|
2019-04-08 04:58:33 +00:00
|
|
|
*/
|
2019-04-01 09:07:16 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* constantRoutes
|
|
|
|
* a base page that does not have permission requirements
|
|
|
|
* all roles can be accessed
|
2019-04-08 04:58:33 +00:00
|
|
|
*/
|
2019-03-15 10:08:12 +00:00
|
|
|
export const constantRoutes = [
|
2018-08-29 07:24:47 +00:00
|
|
|
{
|
|
|
|
path: '/redirect',
|
|
|
|
component: Layout,
|
|
|
|
hidden: true,
|
|
|
|
children: [
|
|
|
|
{
|
2020-01-11 02:25:59 +00:00
|
|
|
path: '/redirect/:path(.*)',
|
2018-08-29 07:24:47 +00:00
|
|
|
component: () => import('@/views/redirect/index')
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
2018-08-15 09:29:15 +00:00
|
|
|
{
|
|
|
|
path: '/login',
|
|
|
|
component: () => import('@/views/login/index'),
|
|
|
|
hidden: true
|
|
|
|
},
|
|
|
|
{
|
2018-09-03 07:03:00 +00:00
|
|
|
path: '/auth-redirect',
|
2019-04-12 09:13:27 +00:00
|
|
|
component: () => import('@/views/login/auth-redirect'),
|
2018-08-15 09:29:15 +00:00
|
|
|
hidden: true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/404',
|
2019-04-12 09:13:27 +00:00
|
|
|
component: () => import('@/views/error-page/404'),
|
2018-08-15 09:29:15 +00:00
|
|
|
hidden: true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/401',
|
2019-04-12 09:13:27 +00:00
|
|
|
component: () => import('@/views/error-page/401'),
|
2018-08-15 09:29:15 +00:00
|
|
|
hidden: true
|
|
|
|
},
|
2017-05-17 08:26:33 +00:00
|
|
|
{
|
2019-05-05 08:49:40 +00:00
|
|
|
path: '/',
|
2017-05-17 08:26:33 +00:00
|
|
|
component: Layout,
|
2019-05-05 08:49:40 +00:00
|
|
|
redirect: '/dashboard',
|
2018-08-15 09:29:15 +00:00
|
|
|
children: [
|
|
|
|
{
|
|
|
|
path: 'dashboard',
|
|
|
|
component: () => import('@/views/dashboard/index'),
|
2018-08-19 08:55:24 +00:00
|
|
|
name: 'Dashboard',
|
2019-05-05 08:49:40 +00:00
|
|
|
meta: { title: 'Dashboard', icon: 'dashboard', affix: true }
|
2018-08-15 09:29:15 +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,
|
2018-08-15 09:29:15 +00:00
|
|
|
children: [
|
|
|
|
{
|
|
|
|
path: 'index',
|
|
|
|
component: () => import('@/views/documentation/index'),
|
2018-08-19 08:55:24 +00:00
|
|
|
name: 'Documentation',
|
2019-05-05 08:49:40 +00:00
|
|
|
meta: { title: 'Documentation', icon: 'documentation', affix: true }
|
2018-08-15 09:29:15 +00:00
|
|
|
}
|
|
|
|
]
|
2018-05-28 06:36:06 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/guide',
|
|
|
|
component: Layout,
|
|
|
|
redirect: '/guide/index',
|
2018-08-15 09:29:15 +00:00
|
|
|
children: [
|
|
|
|
{
|
|
|
|
path: 'index',
|
|
|
|
component: () => import('@/views/guide/index'),
|
2018-08-19 08:55:24 +00:00
|
|
|
name: 'Guide',
|
2019-05-05 08:49:40 +00:00
|
|
|
meta: { title: 'Guide', icon: 'guide', noCache: true }
|
2018-08-15 09:29:15 +00:00
|
|
|
}
|
|
|
|
]
|
2019-04-25 09:45:46 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/profile',
|
|
|
|
component: Layout,
|
|
|
|
redirect: '/profile/index',
|
|
|
|
hidden: true,
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
path: 'index',
|
|
|
|
component: () => import('@/views/profile/index'),
|
|
|
|
name: 'Profile',
|
2019-05-05 08:49:40 +00:00
|
|
|
meta: { title: 'Profile', icon: 'user', noCache: true }
|
2019-04-25 09:45:46 +00:00
|
|
|
}
|
|
|
|
]
|
2017-05-17 08:26:33 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
|
2019-04-01 09:07:16 +00:00
|
|
|
/**
|
|
|
|
* asyncRoutes
|
|
|
|
* the routes that need to be dynamically loaded based on user roles
|
2019-04-08 04:58:33 +00:00
|
|
|
*/
|
2019-03-15 10:08:12 +00:00
|
|
|
export const asyncRoutes = [
|
2017-05-17 08:26:33 +00:00
|
|
|
{
|
|
|
|
path: '/permission',
|
|
|
|
component: Layout,
|
2019-04-15 02:31:06 +00:00
|
|
|
redirect: '/permission/page',
|
2018-05-08 14:15:34 +00:00
|
|
|
alwaysShow: true, // will always show the root menu
|
2019-04-15 02:31:06 +00:00
|
|
|
name: 'Permission',
|
2018-05-08 14:15:34 +00:00
|
|
|
meta: {
|
2019-05-05 08:49:40 +00:00
|
|
|
title: 'Permission',
|
2018-05-08 14:15:34 +00:00
|
|
|
icon: 'lock',
|
|
|
|
roles: ['admin', 'editor'] // you can set roles in root nav
|
|
|
|
},
|
2017-05-17 08:26:33 +00:00
|
|
|
children: [
|
2018-08-15 09:29:15 +00:00
|
|
|
{
|
|
|
|
path: 'page',
|
|
|
|
component: () => import('@/views/permission/page'),
|
2018-08-19 08:55:24 +00:00
|
|
|
name: 'PagePermission',
|
2018-08-15 09:29:15 +00:00
|
|
|
meta: {
|
2019-05-05 08:49:40 +00:00
|
|
|
title: 'Page Permission',
|
2018-08-15 09:29:15 +00:00
|
|
|
roles: ['admin'] // or you can only set roles in sub nav
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: 'directive',
|
|
|
|
component: () => import('@/views/permission/directive'),
|
2018-08-19 08:55:24 +00:00
|
|
|
name: 'DirectivePermission',
|
2018-08-15 09:29:15 +00:00
|
|
|
meta: {
|
2019-05-05 08:49:40 +00:00
|
|
|
title: 'Directive Permission'
|
2018-08-15 09:29:15 +00:00
|
|
|
// if do not set roles, means: this page does not require permission
|
|
|
|
}
|
2019-03-15 10:08:12 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: 'role',
|
|
|
|
component: () => import('@/views/permission/role'),
|
|
|
|
name: 'RolePermission',
|
|
|
|
meta: {
|
2019-05-05 08:49:40 +00:00
|
|
|
title: 'Role Permission',
|
2019-03-15 10:08:12 +00:00
|
|
|
roles: ['admin']
|
|
|
|
}
|
2018-08-15 09:29:15 +00:00
|
|
|
}
|
2017-05-17 08:26:33 +00:00
|
|
|
]
|
|
|
|
},
|
2017-10-26 10:27:39 +00:00
|
|
|
|
2017-05-17 08:26:33 +00:00
|
|
|
{
|
2018-08-15 09:29:15 +00:00
|
|
|
path: '/icon',
|
2017-05-17 08:26:33 +00:00
|
|
|
component: Layout,
|
|
|
|
children: [
|
2018-08-15 09:29:15 +00:00
|
|
|
{
|
|
|
|
path: 'index',
|
2019-04-16 17:01:24 +00:00
|
|
|
component: () => import('@/views/icons/index'),
|
2018-08-19 08:55:24 +00:00
|
|
|
name: 'Icons',
|
2019-05-05 08:49:40 +00:00
|
|
|
meta: { title: 'Icons', icon: 'icon', noCache: true }
|
2018-08-15 09:29:15 +00:00
|
|
|
}
|
2017-07-28 07:12:32 +00:00
|
|
|
]
|
|
|
|
},
|
2017-10-26 10:27:39 +00:00
|
|
|
|
2019-04-01 09:07:16 +00:00
|
|
|
/** when your routing map is too long, you can split it into small modules **/
|
2018-08-15 09:29:15 +00:00
|
|
|
componentsRouter,
|
|
|
|
chartsRouter,
|
|
|
|
nestedRouter,
|
|
|
|
tableRouter,
|
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',
|
2018-08-19 08:55:24 +00:00
|
|
|
name: 'Example',
|
2017-10-31 02:49:24 +00:00
|
|
|
meta: {
|
2019-05-05 08:49:40 +00:00
|
|
|
title: 'Example',
|
2020-06-11 05:57:41 +00:00
|
|
|
icon: 'el-icon-s-help'
|
2017-10-31 02:49:24 +00:00
|
|
|
},
|
|
|
|
children: [
|
2018-08-15 09:29:15 +00:00
|
|
|
{
|
|
|
|
path: 'create',
|
|
|
|
component: () => import('@/views/example/create'),
|
2018-08-19 08:55:24 +00:00
|
|
|
name: 'CreateArticle',
|
2020-06-15 09:18:55 +00:00
|
|
|
meta: { title: 'Create Article', icon: 'edit' }
|
2018-08-15 09:29:15 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: 'edit/:id(\\d+)',
|
|
|
|
component: () => import('@/views/example/edit'),
|
2018-08-19 08:55:24 +00:00
|
|
|
name: 'EditArticle',
|
2019-05-05 08:49:40 +00:00
|
|
|
meta: { title: 'Edit Article', noCache: true, activeMenu: '/example/list' },
|
2018-08-15 09:29:15 +00:00
|
|
|
hidden: true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: 'list',
|
|
|
|
component: () => import('@/views/example/list'),
|
2018-08-19 08:55:24 +00:00
|
|
|
name: 'ArticleList',
|
2019-05-05 08:49:40 +00:00
|
|
|
meta: { title: 'Article List', icon: 'list' }
|
2018-08-15 09:29:15 +00:00
|
|
|
}
|
2017-05-17 08:26:33 +00:00
|
|
|
]
|
|
|
|
},
|
2017-10-26 10:27:39 +00:00
|
|
|
|
2018-06-21 06:26:25 +00:00
|
|
|
{
|
2018-08-15 09:29:15 +00:00
|
|
|
path: '/tab',
|
2018-06-21 06:26:25 +00:00
|
|
|
component: Layout,
|
|
|
|
children: [
|
|
|
|
{
|
2018-08-15 09:29:15 +00:00
|
|
|
path: 'index',
|
|
|
|
component: () => import('@/views/tab/index'),
|
2018-08-19 08:55:24 +00:00
|
|
|
name: 'Tab',
|
2019-05-05 08:49:40 +00:00
|
|
|
meta: { title: 'Tab', icon: 'tab' }
|
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,
|
2019-04-16 05:51:14 +00:00
|
|
|
redirect: 'noRedirect',
|
2018-08-19 08:55:24 +00:00
|
|
|
name: 'ErrorPages',
|
2017-10-26 10:27:39 +00:00
|
|
|
meta: {
|
2019-05-05 08:49:40 +00:00
|
|
|
title: 'Error Pages',
|
2017-10-26 10:27:39 +00:00
|
|
|
icon: '404'
|
|
|
|
},
|
2017-05-17 08:26:33 +00:00
|
|
|
children: [
|
2018-08-15 09:29:15 +00:00
|
|
|
{
|
|
|
|
path: '401',
|
2019-04-12 09:13:27 +00:00
|
|
|
component: () => import('@/views/error-page/401'),
|
2018-08-19 08:55:24 +00:00
|
|
|
name: 'Page401',
|
2019-05-05 08:49:40 +00:00
|
|
|
meta: { title: '401', noCache: true }
|
2018-08-15 09:29:15 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '404',
|
2019-04-12 09:13:27 +00:00
|
|
|
component: () => import('@/views/error-page/404'),
|
2018-08-19 08:55:24 +00:00
|
|
|
name: 'Page404',
|
2019-05-05 08:49:40 +00:00
|
|
|
meta: { title: '404', noCache: true }
|
2018-08-15 09:29:15 +00:00
|
|
|
}
|
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,
|
2018-08-15 09:29:15 +00:00
|
|
|
children: [
|
|
|
|
{
|
|
|
|
path: 'log',
|
2019-04-12 09:13:27 +00:00
|
|
|
component: () => import('@/views/error-log/index'),
|
2018-08-19 08:55:24 +00:00
|
|
|
name: 'ErrorLog',
|
2019-05-05 08:49:40 +00:00
|
|
|
meta: { title: 'Error Log', icon: 'bug' }
|
2018-08-15 09:29:15 +00:00
|
|
|
}
|
|
|
|
]
|
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',
|
2018-08-19 08:55:24 +00:00
|
|
|
name: 'Excel',
|
2017-10-26 10:27:39 +00:00
|
|
|
meta: {
|
2019-05-05 08:49:40 +00:00
|
|
|
title: 'Excel',
|
2017-10-26 10:27:39 +00:00
|
|
|
icon: 'excel'
|
|
|
|
},
|
2017-07-25 08:51:43 +00:00
|
|
|
children: [
|
2018-08-15 09:29:15 +00:00
|
|
|
{
|
|
|
|
path: 'export-excel',
|
2019-04-12 09:13:27 +00:00
|
|
|
component: () => import('@/views/excel/export-excel'),
|
2018-08-19 08:55:24 +00:00
|
|
|
name: 'ExportExcel',
|
2019-05-05 08:49:40 +00:00
|
|
|
meta: { title: 'Export Excel' }
|
2018-08-15 09:29:15 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: 'export-selected-excel',
|
2019-04-12 09:13:27 +00:00
|
|
|
component: () => import('@/views/excel/select-excel'),
|
2018-08-31 06:45:29 +00:00
|
|
|
name: 'SelectExcel',
|
2019-05-05 08:49:40 +00:00
|
|
|
meta: { title: 'Export Selected' }
|
2018-08-15 09:29:15 +00:00
|
|
|
},
|
2019-03-17 08:52:11 +00:00
|
|
|
{
|
|
|
|
path: 'export-merge-header',
|
2019-04-12 09:13:27 +00:00
|
|
|
component: () => import('@/views/excel/merge-header'),
|
2019-03-17 08:52:11 +00:00
|
|
|
name: 'MergeHeader',
|
2019-05-05 08:49:40 +00:00
|
|
|
meta: { title: 'Merge Header' }
|
2019-03-17 08:52:11 +00:00
|
|
|
},
|
2018-08-15 09:29:15 +00:00
|
|
|
{
|
|
|
|
path: 'upload-excel',
|
2019-04-12 09:13:27 +00:00
|
|
|
component: () => import('@/views/excel/upload-excel'),
|
2018-08-19 08:55:24 +00:00
|
|
|
name: 'UploadExcel',
|
2019-05-05 08:49:40 +00:00
|
|
|
meta: { title: 'Upload Excel' }
|
2018-08-15 09:29:15 +00:00
|
|
|
}
|
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,
|
2019-04-15 02:31:06 +00:00
|
|
|
name: 'Zip',
|
2019-05-05 08:49:40 +00:00
|
|
|
meta: { title: 'Zip', icon: 'zip' },
|
2018-08-15 09:29:15 +00:00
|
|
|
children: [
|
|
|
|
{
|
|
|
|
path: 'download',
|
|
|
|
component: () => import('@/views/zip/index'),
|
2018-08-19 08:55:24 +00:00
|
|
|
name: 'ExportZip',
|
2019-05-05 08:49:40 +00:00
|
|
|
meta: { title: 'Export Zip' }
|
2018-08-15 09:29:15 +00:00
|
|
|
}
|
|
|
|
]
|
2017-09-26 05:40:07 +00:00
|
|
|
},
|
2017-10-26 10:27:39 +00:00
|
|
|
|
2018-12-27 05:42:10 +00:00
|
|
|
{
|
|
|
|
path: '/pdf',
|
|
|
|
component: Layout,
|
|
|
|
redirect: '/pdf/index',
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
path: 'index',
|
|
|
|
component: () => import('@/views/pdf/index'),
|
|
|
|
name: 'PDF',
|
2019-05-05 08:49:40 +00:00
|
|
|
meta: { title: 'PDF', icon: 'pdf' }
|
2018-12-27 05:42:10 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/pdf/download',
|
|
|
|
component: () => import('@/views/pdf/download'),
|
|
|
|
hidden: true
|
|
|
|
},
|
|
|
|
|
2017-05-17 08:26:33 +00:00
|
|
|
{
|
|
|
|
path: '/theme',
|
|
|
|
component: Layout,
|
2018-08-15 09:29:15 +00:00
|
|
|
children: [
|
|
|
|
{
|
|
|
|
path: 'index',
|
|
|
|
component: () => import('@/views/theme/index'),
|
2018-08-19 08:55:24 +00:00
|
|
|
name: 'Theme',
|
2019-05-05 08:49:40 +00:00
|
|
|
meta: { title: 'Theme', icon: 'theme' }
|
2018-08-15 09:29:15 +00:00
|
|
|
}
|
|
|
|
]
|
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,
|
2018-08-15 09:29:15 +00:00
|
|
|
children: [
|
|
|
|
{
|
|
|
|
path: 'index',
|
|
|
|
component: () => import('@/views/clipboard/index'),
|
2018-08-19 08:55:24 +00:00
|
|
|
name: 'ClipboardDemo',
|
2019-05-05 08:49:40 +00:00
|
|
|
meta: { title: 'Clipboard', icon: 'clipboard' }
|
2018-08-15 09:29:15 +00:00
|
|
|
}
|
|
|
|
]
|
2017-09-27 02:03:42 +00:00
|
|
|
},
|
2017-06-15 06:33:02 +00:00
|
|
|
|
2018-08-24 02:06:09 +00:00
|
|
|
{
|
|
|
|
path: 'external-link',
|
|
|
|
component: Layout,
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
path: 'https://github.com/PanJiaChen/vue-element-admin',
|
2019-05-05 08:49:40 +00:00
|
|
|
meta: { title: 'External Link', icon: 'link' }
|
2018-08-24 02:06:09 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
|
2019-05-05 08:49:40 +00:00
|
|
|
// 404 page must be placed at the end !!!
|
2017-05-17 08:26:33 +00:00
|
|
|
{ path: '*', redirect: '/404', hidden: true }
|
2017-08-22 07:43:34 +00:00
|
|
|
]
|
2019-04-01 09:07:16 +00:00
|
|
|
|
|
|
|
const createRouter = () => new Router({
|
|
|
|
// mode: 'history', // require service support
|
|
|
|
scrollBehavior: () => ({ y: 0 }),
|
|
|
|
routes: constantRoutes
|
|
|
|
})
|
|
|
|
|
|
|
|
const router = createRouter()
|
|
|
|
|
|
|
|
// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
|
|
|
|
export function resetRouter() {
|
|
|
|
const newRouter = createRouter()
|
|
|
|
router.matcher = newRouter.matcher // reset router
|
|
|
|
}
|
|
|
|
|
|
|
|
export default router
|