小程序 lifeCycleMethod onLoad function SyntaxError: Unexpected end of JSON input

wx.navigateTo  跳转传参数时, json解析数据报如下错误 lifeCycleMethod onLoad function SyntaxError: Unexpected end of JSON input,

解决方案:一般获取的json数据先转换成string字符,如:JSON.stringify(json),然后用encodeURIComponent 编码,如encodeURIComponent(string), 就可以传参过去了,到接收页 ,先 decodeURIComponent(data),然后在 JSON.parse() 取得json数据 赋值!
 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章