import VueRouter from "vue-router"; import Vue from "vue"; import My from "../components/My.vue"; import Login from "../views/login.vue" import Home from "../views/home.vue" import Doctorhome from "../views/doctorhome.vue"; Vue.use(VueRouter) const router = new VueRouter({ routes:[ {path:'/my',component:My}, {path:'/login',component:Login}, { path: '/home', name: 'Home', component: Home, meta: { requireAuth: true }, redirect: '/home/index', children:[ { path:'/home/index', name:'Index', component:() => import('@/views/home/index'), meta:{ requireAuth:true } }, { path:'/home/user', name:'User', component:()=>import('@/views/user/index'), meta:{ requireAuth:true } } ] }, { path: '/doctor', name: 'Doctor', component: Doctorhome, children:[ { path:'/doctor/report', name:'Report', component:() => import('@/views/doctor/report.vue'), meta:{ requireAuth:true } }, { path:'/doctor/academic', name:'Academic', component:()=>import('@/views/doctor/academic.vue'), meta:{ requireAuth:true } } ] }, ] }) export default router