目前測試倆種方法均可
傳參方式1:
1)父組件通過name來匹配
this.$router.push({
name: 'Describe',
params: {
id: id
}
})
2)相應路由配置:
{
path: '/describe/:id',
name: 'Describe',
component: Describe
}
3)子組件是通過:
this.$route.params.id
傳參方式2:
父組件:this.$router.push({
path: '/describe',
query: {
id: id
}
})
路由設置:
{
path: '/describe',
name: 'Describe',
component: Describe
}
子組件獲取:
this. $route.query.id