Cannot read property 'result' of undefined咋回事?
发布于 4 年前 作者 mengxiulan 919 次浏览 来自 问答

萌新一个,这个错误咋回事啊QAQ,

getLocaFun().thenfunctionres

return getCityFunres);

})

catchfunction()

// 首页-未开启定位

wxreportAnalytics’viewstoreclick_d’);

commoncommonObjgetUserSetting();

})

thenfunctionres

consolelogresresultad_info

let ad_info resresultad_info

let cityName ad_infocity

let location ad_infolocation

ifwxgetStorageSync’city’&& cityName != wxgetStorageSync’city’).cityName//切换城市,清空门店数据

wxsetStorageSync’selfLiftStore’’’);

 

ifcityName && location wxsetStorageSync’userCurrLoca’,{'cityName’cityName’location’location});

returntypeof cb ==‘function’&& cb();

})

},

3 回复

这个是经常见到的,某个字段 ‘xxx of undefined’,指的是某个字段没定义,你却在代码中引用了,在这里就是res对象上没有result这个字段,你却在代码中引用了,就会报这个错误

console.log(res); 打印一下

当然是你的代码里面有地方用了个undefined的对象去点了result。

类似于:

let a

a.result;

这些地方建议打印下res。看是否undefined

回到顶部