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

时间:2020-01-15 18:49:32   收藏:0   阅读:399
传:
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);

原文:https://www.cnblogs.com/gzhbk/p/12198116.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!