EasyClick易点云测 执行错误:SyntaxError: Unexpected token: u

执行错误:SyntaxError: Unexpected token: u

此问题为JSON.parse时,你所解析的json字符串不存在或未赋值 undefined

 
 
let a
logd(a)
a = JSON.parse(a)
//undefined
//执行错误:执行错误:SyntaxError: Unexpected token: u

解决方法:

解析前对变量进行判断

 
 
let a
if(a){
    a = JSON.parse(a)
}

猜你喜欢

转载自blog.csdn.net/mr_oldcold/article/details/121021478