0
警告有一个函数,从阿贾克斯需要一个数据:我怎么打悬而未决变量WebStorm
function test(str){
var obj=JSON.parse(str);
console.log(obj.xxx);
}
WebStorm说xxx
- 是悬而未决的变量。 我不能使用@namespace
。那我该怎么办?
警告有一个函数,从阿贾克斯需要一个数据:我怎么打悬而未决变量WebStorm
function test(str){
var obj=JSON.parse(str);
console.log(obj.xxx);
}
WebStorm说xxx
- 是悬而未决的变量。 我不能使用@namespace
。那我该怎么办?
在实际数据仅在运行时知道的情况下(例如,当数据是通过ajax调用设置的值时),它在静态分析过程中无法解析,因此预计会发出警告。有关可能的解决方法,请参阅https://youtrack.jetbrains.com/issue/WEB-17419#comment=27-1058451,http://devnet.jetbrains.com/message/5504337#5504337。
你试过了吗var obj = str.json();'? –
'str.json'不是函数 –
你能提供被解析的字符串吗? – Joel