vue二级路由的配置

时间:2025-01-20 15:30:16
import Vue from 'vue' import VueRouter from 'vue-router' // @ 指向src 用./容易混 import Comingsoon from '@/views/Film/Comingsoon' import Nowplaying from '@/views/Film/Nowplaying' import Mess from '@/views/Mess' import Person from '@/views/Person' import More from '@/views/More' Vue.use(VueRouter) /* const auth = { isLogin () { return false } } */ const router = new VueRouter({ // mode: 'history', // base: .BASE_URL, routes: [ { path: '/mess', component: Mess, children: [ { path: '/mess/nowplaying', component: Nowplaying }, { path: '/mess/comingsoon', component: Comingsoon }, { path: '', redirect: '/mess/nowplaying' } ] }, { path: '/person', component: Person }, { path: '/more', component: More }, { path: '*', redirect: '/mess' } ] }) export default router