0
点赞
收藏
分享

微信扫一扫

小程序navigateTo 转参注意二点。JSON.stringify(object),JSON.parse(String),encodeURIComponentdecodeURIComponent

岛上码农 2022-09-02 阅读 182

传:
1. JSON.stringify(object); 转String
2.encodeURIComponent编码

var currentObj =encodeURIComponent(JSON.stringify(e.currentTarget.dataset.index));

wx.navigateTo({
url: '../../pages/order/orderDetail/orderDetail?currentObj=' + currentObj
});


================================================
接收:
1.String 转对象 JSON.parse(String)
2.decodeURIComponent解码

var currentObj = JSON.parse(decodeURIComponent(options.currentObj));
console.log("currentObj",currentObj);

举报

相关推荐

0 条评论