小程序url跳转参数丢失
使用
encodeURIComponent
进行编码然后用decodeURIComponent
解码
// 发送
toShopInfo(e) {
let urlData = JSON.stringify(e.currentTarget.dataset.info);
wx.navigateTo({
url: "/pages/shopInfo/shopInfo?info=" + encodeURIComponent(urlData),
});
},
// 接收
onLoad(options) {
console.log("options:", decodeURIComponent(options.info));
},