vue报错解决:Error in v-on handler (Promiseasync) “TypeError Cannot read properties ofundefined
报错信息:[Vue warn]: Error in v-on handler (Promise/async): "TypeError: Cannot read properties of undefined (reading 'code ')” axios可以获取数据,控制台输出为undefined报错代码:错误原因:在①或者②的axios请求时,请求结果被catch捕获,所以axios可以获取到
   ·  
 报错信息:[Vue warn]: Error in v-on handler (Promise/async): "TypeError: Cannot read properties of undefined (reading 'code ')” axios可以获取数据,控制台输出为undefined
  报错代码:
  错误原因:在①或者②的axios请求时,请求结果被catch捕获,所以axios可以获取到数据,但在catch中的res此时是未赋值的,所以控制台在③处调用res.xxx会出现报错
  解决方法:只需要在catch中将axios获取到的数据赋值给res即可
修改后:

更多推荐
 
 



所有评论(0)