【转载自】:https://blog.csdn.net/qq_30378229/article/details/78429374

在Vue中this始终指向Vue,但axios中this为undefined,例如

【vue】this与that 一个坑

若需要赋值给变量用以渲染数据,可以通过=>函数,这时this为Vue

【vue】this与that 一个坑

或者可以直接通过: 
let that = this 
将this保存在that中,再在函数中使用that均可 
被坑了很久,一直打印出来undefined,终于解决了

相关文章:

  • 2021-05-01
  • 2021-06-16
  • 2021-08-20
  • 2022-01-16
猜你喜欢
  • 2021-07-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-02
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案