JSON方法传值
传:
let params = JSON.stringify(this.user)
uni.navigateTo({
url: ‘/pages/order/list?params=’ + params + ‘&type=’ + type
})
接:
onLoad(options) {
this.options = options
let params = JSON.parse(options.params)
},
这是因为你传值里出现了特殊字符,因为需要借助decodeURIComponent来转换
传:
let params = JSON.stringify(this.user)
uni.navigateTo({
url: ‘/pages/order/list?params=’ + encodeURIComponent(params)+ ‘&type=’ + type
})
接:
onLoad(options) {
this.options = options
let newData= decodeURIComponent((options.params));
let data = JSON.parse(newData);
},