1. 重定向也是通过 routes 配置来完成,下面例子是从 /a 重定向到 /b
    2. const router = new VueRouter({
    3. routes: [
    4. { path: '/a', redirect: '/b' }
    5. ]
    6. })
    1. //router/index.js
    2. const routes = [
    3. {
    4. path: '/films',
    5. name: 'films',
    6. component: Films,
    7. children:[
    8. {
    9. path:'nowPlaying',
    10. component:()=>import('../views/NowPlaying.vue')
    11. },
    12. {
    13. path:'comingSoon',
    14. component:()=>import('../views/ComingSoon.vue')
    15. }
    16. ],
    17. redirect:"/films/nowPlaying"
    18. },
    19. ]