uni-app中encodeURIComponent(JSON.stringify( 数组 ))怎样解析
uni-app中encodeURIComponent(JSON.stringify( 数组 ))怎样解析
示例代码:
webview传值 encodeURIComponent(JSON.stringify( 数组 )) 解析不了
操作步骤:
webview传值 encodeURIComponent(JSON.stringify( 数组 )) 解析不了
预期结果:
解析成功
实际结果:
Uncaught SyntaxError: Unexpected token , in JSON at position0
bug描述:
webview传值 encodeURIComponent(JSON.stringify( 数组 )) 解析不了
| 开发环境 | 版本号 | 项目创建方式 |
|---|---|---|
| Windows | win10教育版 1909 | HBuilderX |
| Android | Android 11 | |
| 华为 | 18398794488 | |
| vue | ||
| 云端 | ||
| HBuilderX | 3.1.19 |
更多关于uni-app中encodeURIComponent(JSON.stringify( 数组 ))怎样解析的实战教程也可以访问 https://www.itying.com/category-93-b0.html
let good={name:‘哈哈哈’}
// 编码
let data=encodeURIComponent(JSON.stringify(good))
console.log(data);
// 解析
let str=JSON.parse(decodeURIComponent(data));
console.log(str);
JSON.parse(decodeURIComponent(data));
这样写应该没问题
更多关于uni-app中encodeURIComponent(JSON.stringify( 数组 ))怎样解析的实战教程也可以访问 https://www.itying.com/category-93-b0.html
好像还是有问题喔


