import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)
const routes = [
{
path: '/login',
name: '登录',
meta: {
show:false,
requireAuth:false,
title: '登录'
},
component: ()=>import('@/views/login/index')
},
{
path: '/',
name: '导航一',
component: ()=>import('@/views/index'),
meta: {
show:true,
requireAuth:true,
title: '首页',
src: '/'
},
redirect: '/PageOne',
children: [
{
path: '/PageOne',
name: '导航1-1',
component: ()=>import('@/views/nav_1/Page1'),
meta: {
title: '子组件一',
src: '/PageOne'
}
},
{
path: '/PageTwo',
name: '导航1-2',
component: ()=>import('@/views/nav_1/Page2'),
meta: {
title: '子组件二',
src: '/PageTwo'
}
}
]
},
{
path: '/two',
name: '导航二',
component: ()=>import('@/views/index'),
meta: {
show:true,
requireAuth:true
},
children: [
{
path: '/PageThree',
name: '导航2-1',
component: ()=>import('@/views/nav_2/Page1')
},
{
path: '/PageFor',
name: '导航2-2',
component: ()=>import('@/views/nav_2/Page2'),
meta: {
show:true,
requireAuth:true
},
}
]
}
]
const router = new VueRouter({
mode: 'history',
base: process.env.BASE_URL,
routes
})
export default router