vue中父子路由的配置
import Vue from 'vue'import Router from 'vue-router'import HelloWorld from '../components/HelloWorld'import Login from '../view/login/Login'import Index from '../view/index'import StudentNavMenu ...
·
import Vue from 'vue'
import Router from 'vue-router'
import HelloWorld from '../components/HelloWorld'
import Login from '../view/login/Login'
import Index from '../view/index'
import StudentNavMenu from '../view/student/StudentNavMenu'
import StudentTestPlan from '../view/student/StudentTestPlan'
import StudentGradeList from '../view/student/StudentGradeList'
import StudentBaseInformation from '../view/student/StudentBaseInformation'
import TeacherNavMenu from '../view/teacher/TeacherNavMenu'
import UserNavMenu from '../view/user/UserNavMenu'
import SetNavMenu from '../view/set/SetNavMenu'
Vue.use(Router)
export default new Router({
routes: [
{
path: '/HelloWorld',
name: 'HelloWorld',
component: HelloWorld
},
{
path: '/index',
name: 'index',
component: Index,
meta: {
title: '学生管理系统'
},
children: [{
path: '/studentNavMenu',
name: 'StudentNavMenu',
component: StudentNavMenu,
children: [{
path: '/StudentTestPlan',
name: 'StudentTestPlan',
component: StudentTestPlan
},
{
path: '/studentGradeList',
name: 'StudentGradeList',
component: StudentGradeList
},
{
path: '/studentBaseInformation',
name: 'StudentBaseInformation',
component: StudentBaseInformation
}
]
},
{path: '/teacherNavMenu',
name: 'TeacherNavMenu',
component: TeacherNavMenu
},
{path: '/userNavMenu',
name: 'UserNavMenu',
component: UserNavMenu
},
{
path: '/setNavMenu',
name: 'SetNavMenu',
component: SetNavMenu
}
]
},
{
path: '/login',
name: 'login',
component: Login
}
]
})
在children中添加路由
如果需要加载页面则 在页面中使用
to 后面为子路由的地址
更多推荐
已为社区贡献3条内容
所有评论(0)