Vue Router - 多级路由(嵌套路由)

内容

  1. 配置路由规则,使用children配置项

    routes:[
            {
                path:'/about',
                component:About
            },
            {
                path:'/home',
                component:Home,
                children:[
                    {
                        path:'news',
                        component:News
                    },
                    {
                        path:'message',
                        component:Message
                    }
                ]
            }
        ]
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
  2. 跳转(完整路径

    <router-link class="list-group-item" active-class="active" to="/home/news">News</router-link>
    
    1