69 lines
1.7 KiB
JavaScript
69 lines
1.7 KiB
JavaScript
|
|
import VueRouter from "vue-router";
|
||
|
|
|
||
|
|
const routes=[
|
||
|
|
{
|
||
|
|
path:'/login',
|
||
|
|
name:'login',
|
||
|
|
component: () => import('../components/Login')
|
||
|
|
},
|
||
|
|
{
|
||
|
|
path:'/index',
|
||
|
|
name:'index',
|
||
|
|
component: () => import('../components/Index'),
|
||
|
|
children:[
|
||
|
|
{
|
||
|
|
path:'/home',
|
||
|
|
name:'home',
|
||
|
|
meta:{
|
||
|
|
title:'首页'
|
||
|
|
},
|
||
|
|
component: () => import('../components/Home')
|
||
|
|
},
|
||
|
|
{
|
||
|
|
path:'/admin',
|
||
|
|
name:'admin',
|
||
|
|
meta:{
|
||
|
|
title:'超级管理员'
|
||
|
|
},
|
||
|
|
component: () => import('../components/admin/Admin')
|
||
|
|
},
|
||
|
|
{
|
||
|
|
path:'/user',
|
||
|
|
name:'user',
|
||
|
|
meta:{
|
||
|
|
title:'用户'
|
||
|
|
},
|
||
|
|
component: () => import('../components/user/User')
|
||
|
|
},
|
||
|
|
{
|
||
|
|
path:'/admin',
|
||
|
|
name:'admin',
|
||
|
|
meta:{
|
||
|
|
title:'管理员'
|
||
|
|
},
|
||
|
|
component: () => import('../components/admin/Admin')
|
||
|
|
},
|
||
|
|
{
|
||
|
|
path:'/main',
|
||
|
|
name:'main',
|
||
|
|
meta:{
|
||
|
|
title:'用户管理'
|
||
|
|
},
|
||
|
|
component: () => import('../components/Main')
|
||
|
|
}
|
||
|
|
]
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
]
|
||
|
|
|
||
|
|
const route=new VueRouter({
|
||
|
|
mode:'history',
|
||
|
|
routes
|
||
|
|
})
|
||
|
|
const VueRouterPush = VueRouter.prototype.push
|
||
|
|
VueRouter.prototype.push = function push (to) {
|
||
|
|
return VueRouterPush.call(this, to).catch(err => err)
|
||
|
|
}
|
||
|
|
|
||
|
|
export default route;
|