今天遇到的坑,直接传参,正常参数都能接收到,但是就是url参数值接收后NaN.
后来去网上搜索一下说路径必须编码才可以,分享出来就是希望大家不要跟我一样遇到这种坑~~~
onShareAppMessage: function (options)
return {
title: '标题',
path: '/pages/index/index?index'id=123&str=' + JSON.stringify(obj)+ '&path=' + encodeURIComponent(url),
}
}
注意的点:
参数值是对象:JSON.stringify(obj) 接收:JSON.parse(obj)
参数值是路径:encodeURIComponent(url) 接收:decodeURIComponent(url)