signed

QiShunwang

“诚信为本、客户至上”

镶嵌路由:实现/home/news

2021/4/26 23:07:59   来源:

如:
const router = new VueRouter({
routes: [
{ path: ‘/user/:id’, component: User,
children: [
{
// 当 /user/:id/profile 匹配成功,
// UserProfile 会被渲染在 User 的 中
path: ‘profile’,
component: UserProfile
},
{
// 当 /user/:id/posts 匹配成功
// UserPosts 会被渲染在 User 的 中
path: ‘posts’,
component: UserPosts
}
]
}
]
})
具体详情:

点这里https://router.vuejs.org/zh/guide/essentials/nested-routes.html