首页 > 其他分享 >嵌套路由

嵌套路由

时间:2022-12-01 12:13:57浏览次数:36  
标签:component 嵌套 path message children 路由

1.嵌套路由 (多级路由)

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

    

 routes:[
    {
        path: '/about",
        component:About,
    },
    {
        path:' /home",
        component :Home ,
        children:[ //通过children配置子级路由
            {
                path:'news',//此处一定不要写: /news
                component:News
            },
            {
                path:'message',//此处一定不要写: /message
                component:Message
            }
    }
 ]                            

  2.跳转 (要写完整路径) :

  

<router-link to="/home/news">News</router-link>

  

标签:component,嵌套,path,message,children,路由
From: https://www.cnblogs.com/hilxj/p/16941027.html

相关文章