1.配置路由的规则,使用children配置项:
routes:[
{
path:'/about',
component:About,
},
{
path:'/home',
component:Home,
children:[//通过children配置子级路由
{
path:'news',//此处不要写:/news
component:News,
},
{
path:'message',//此处不要写:/message
component:Message,
children:[
{
path:'detail',//此处不要写:/detail
component:Detail,
}
]
},
]
}
]
2.跳转(要写完整路径)
<router-link to="/home/message">Message</router-link>