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


传:
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);


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM