import { createRouter, createWebHashHistory } from "vue-router" const router = createRouter({ history: createWebHashHistory(), routes: [{ path: '/', redirect: '/login' //默认页面 }, { path: '/index', name: 'Index', component: () => import('./view/student/index.vue') }, { path: '/login', name: 'Login', component: () => import('./view/Login.vue') }, { path: '/register', name: 'Register', component: () => import('./view/Register.vue') }, { path: '/student', name: 'Student', component: () => import('./view/student/index.vue'), redirect: '/student/home', children:[ { path: 'home', name: 'Home', component: () => import('./view/student/home.vue'), }, { path: 'personalCenter', component: () => import('./view/student/personalCenter.vue'), }, { path: 'discussion', component: () => import('./view/student/discussion.vue'), }, { path: 'myExam', component: () => import('./view/student/myExam.vue'), }, { path: 'myScore', component: () => import('./view/student/myScore.vue'), }, { path: 'exam', name: 'Exam', component: () => import('./view/student/exam.vue'), } ] }, ] }) export default router