this.$router.push传参有两种方式:
1、query方式,相当于get请求,参数会在URL地址中显示
this.$router.push({
path: '/test/index', //请求地址
query: { id: row.id,name:row.name }, //参数,多个用逗号分隔
})
//当然直接在地址后拼接也是可以的
this.$router.push('test?id=' + row.id +'&name='+row.name);
2、params方式,相当于post请求
this.$router.push({
name: '/test/index', //请求地址
params: { id: row.id,name:row.name }, //参数,多个用逗号分隔
})
获取参数使用 this.$route.query.id 或者 this.$route.params.id