常用以下两种
1.path query
跳转
//跳转详情
this.$router.push({
path: '/url',
query: {
id:id//参数
}
})
接受:
var id = this.$route.query.id; //接受参数
2.使用name +路由名称,params + 参数
//跳转详情
this.$router.push({
name: 'url',
params: {
id:id//参数
}
})
接收:
var id = this.$route.query.id; //接受参数
总结:
使用path + 路径,query + 参数。则用this.$route.query.id取值。
使用name +路由名称,params + 参数。则用this.$route.params.id取值。