TIP
本页面文档暂未更新
传递对象类型的参数
- 使用
JSON.stringify()
与JSON.parse()
对参数进行转换 - 即将跳转的页面
js
let routerParams_tosend = {
xxx:'xxx',
...
}
this.$router.push({
path: 'xxx/xxx',
query: {
routerParams_receive: JSON.stringify(routerParams_tosend)
}
})
let routerParams_tosend = {
xxx:'xxx',
...
}
this.$router.push({
path: 'xxx/xxx',
query: {
routerParams_receive: JSON.stringify(routerParams_tosend)
}
})
- 跳转后的页面
js
export default {
data() {
return {
routerParams_receive_data : null,
}
},
created() {
// created里接收router传递的参数
this.routerParams_receive_data = JSON.parse(this.$route.query.routerParams_receive)
}
}
export default {
data() {
return {
routerParams_receive_data : null,
}
},
created() {
// created里接收router传递的参数
this.routerParams_receive_data = JSON.parse(this.$route.query.routerParams_receive)
}
}