Cannot read property 'data' of undefined?

小程序 文章 2022-03-12 21:20 693 0 全屏看文

AI助手支持GPT4.0

Cannot read property 'data' of undefined?Cannot read property 'data' of undefined?

Cannot read property 'data' of undefined?

箭头函数试过了,也不行,麻烦帮忙解决下。

The arrow function has been tried, but it doesn't work. Please help solve it.

回答:

拾忆:

你这个请求嵌套太多层级了,并不是所有都是箭头函数this被覆盖了,函数内第一行重新定义下 let _this=this; 然后把下面的this都替换掉试下。

城市多少盏灯:也不行
拾忆:我说的是函数内的第一行
〃静:心里清楚
城市多少盏灯:???
Mr.Zhao:

this是undefined? 打印下this看看

城市多少盏灯:
Mr.Zhao:哎,你先打印this啊,第一行都报错了,下面就不执行了
城市多少盏灯:underfined
Mr.Zhao:每个回调的第一行都打印下this,  哪个有值就用哪个
城市多少盏灯:上面有,要怎么引用
Mr.Zhao:哪个上面?
城市多少盏灯:不用了,已解决,谢谢

-EOF-

AI助手支持GPT4.0