因为JSON.stringify 后的字符串通过 URL 传递时,特殊字符(如 /、=、& 等)会被自动转义(比如 %22 代表双引号),如果直接 JSON.parse 会因字符不匹配报错,必须先解码。
https://www.xxxx.com/Gateway/InterfaceV?InstitutionIDxxxx
传递页面
let BankRedirctFormH5 = {
imp: "https://www.chinaxxx.com/Gateway/InterfaceV?InstitutionID=008824&Txxxxx"
}
uni.navigateTo({
url:'/subpackageAnew/myCard/BankRedirctFormH5?impOBJ=' + JSON.stringify(BankRedirctFormH5)
})
接受页面
onLoad(options) {
// 先解码(对应跳转前的 encodeURIComponent)
const decodeStr = decodeURIComponent(options.impOBJ);
// 再解析 JSON
this.impOBJ = JSON.parse(decodeStr);
console.log("解析成功:", this.impOBJ);
// this.imp = op.imp
},