1.query方式:
(注意:path要用‘/’+跳转页的名字)
传出页多传一个query对象
data(){
return{
var a = '123'
}
A(){
this.$router.push({
path: '/跳转页的名字',
query: {
id: id
value:this.a
}
})
}
接收页直接用 this.$route.query.属性名
就可以拿到了(注意是route不是router):
this.$route.query.id
this.$route.query.value
2.params方式:
(注意:name直接+跳转页的名字,不用‘/’)
传出页多传一个params对象
data(){
return{
var b = '123'
}
}
B(){
this.$router.push({
name: '跳转页的名字',
params: {
id: id
value:this.b
}
})
}
接收页直接用 this.$route.params.属性名
就可以拿到了(注意是route不是router):
this.$route.params.id
this.$route.params.value