为什么,wx.navigateTo到新对象,不支持 对象里面 有 & 号啊?
代码片段: https://developers.weixin.qq.com/s/Vy1si6m77Kri
let list = {
title:"小心草丛&收到" // 跳转到新页面,为什么报错? &
}
let type = 1
list = JSON.stringify(list);
wx.navigateTo({
url: '/pages/details/details' + `?list=${list}&type=${type}`,
})
/**
* details 生命周期函数--监听页面加载
*/
onLoad: function (options) {
var self = this;
// console.log("options=>", options)
let {
list,
type
} = options;
list = JSON.parse(list) // 报错 list.title ,有 & 符号,list {字符串,对象} 都不行,官方回应下?
}
JSON.stringify后用encodeURIComponent编码,传过去再解码
url只能是字符串
at JSON.parse (<anonymous>)
at qi.onLoad (details.js? [sm]:25)
at qi.<anonymous> (VM233 WAService.js:2)
at qi.r.__callPageLifeTime__ (VM233 WAService.js:2)
at Cn (VM233 WAService.js:2)
at VM233 WAService.js:2
at An (VM233 WAService.js:2)
at Function.<anonymous> (VM233 WAService.js:2)
at u.<anonymous> (VM233 WAService.js:2)
at u.emit (VM233 WAService.js:2)
不是有截图吗?
./details?list={"title":"小心草丛&收到"}&type=1
代码片段 https://developers.weixin.qq.com/s/Vy1si6m77Kri