【微信小程序】微信小程序页面url传参,使用JSON.parse报错Unexpected end of JSON input
时间:2021-05-04 23:37:46
收藏:0
阅读:44
微信小程序页面url传参,使用JSON.parse报错Unexpected end of JSON input
一开始以为是url传参的长度限制原因。
其实是因为参数中有特殊字符导致数据截取,所以接收参数后,无法解析json格式。
用的解决方法是encodeURIComponent()和decodeURIComponent(),见参考文章。
原文:https://www.cnblogs.com/musecho/p/14730155.html
评论(0)