admin-fe/src/router/index.js

105 lines
2.0 KiB
JavaScript
Raw Normal View History

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 */
import Layout from '@/views/layout/Layout'
2017-05-17 08:26:33 +00:00
export const constantRouterMap = [
{
path: '/redirect',
component: Layout,
hidden: true,
children: [
{
path: '/redirect/:path*',
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',
2018-08-15 09:29:15 +00:00
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,
2019-02-23 21:40:26 +00:00
redirect: '/users/index'
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 = [
2019-02-22 19:38:56 +00:00
{
path: '/users',
component: Layout,
children: [
{
path: 'index',
component: () => import('@/views/users/index'),
name: 'Users',
meta: { title: 'users', icon: 'peoples', noCache: true }
}
]
},
2019-03-30 06:15:11 +00:00
{
path: '/reports',
component: Layout,
children: [
{
path: 'index',
component: () => import('@/views/reports/index'),
name: 'Reports',
meta: { title: 'reports', icon: 'documentation', noCache: true }
}
]
},
{
path: '/settings',
component: Layout,
children: [
{
path: 'index',
component: () => import('@/views/settings/index'),
name: 'Settings',
meta: { title: 'settings', icon: 'settings', noCache: true }
}
]
},
{
path: '/users/:id',
component: Layout,
children: [
{
path: '',
name: 'UsersShow',
component: () => import('@/views/users/show')
}
],
hidden: true
},
2017-05-17 08:26:33 +00:00
{ path: '*', redirect: '/404', hidden: true }
2017-08-22 07:43:34 +00:00
]