前端请求出现unable to decode value错误

请求时如图出现unable to decode value

 错误分析:是因为PRIMEWEEK5%OFF20222fa69b57中有%非法字符

传输的参数中含有- _ . ! ~ * ’ ( )% 等非法字符都会出现错误

解决办法:使用encodeURI函数

//含有非法字符的值
this.pickedCouponCode = pickedCoupon.code;

//把非法字符放入encodeURI()函数,即可解决解码问题
let code=encodeURI(this.pickedCouponCode)

猜你喜欢

转载自blog.csdn.net/weixin_57163112/article/details/125741827
今日推荐