原文:Uncaught (in promise) TypeError:的错误

错误 创建一个vue实例,在data定义一些变量,如activityTime。 在methods里面用了axios发送请求。 在then的回调里使用this.activityTime 报错 原因。then没有跟promise实例同步执行就会出现上述的错误。 axios的then function console.dir this this gt undefined 解决 可以用bind绑定thi ...

2017-05-19 11:02 0 1217 推荐指数:

查看详情

Uncaught (in promise) TypeError: this.setState is not a function

造成这个的原因多数是因为,  this  的指向错误,尤其是在我们  自定义函数  的时候报错 解决办法: 将自定义函数改成箭头函数 如,将这种写法 换成箭头函数,就变成 这样就行了。 ...

Thu May 28 00:59:00 CST 2020 0 1847
 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM