问题:http status 500,使用axios请求时,拿不到验证码错误信息,排查下来,是没有理解好axios的error对象信息

1.在http status为500状态下,会走.catch(error)

2.打印

.catch(function (error) {
        console.log(error.data);//undefined,之前以为这样可以拿到错误信息
        console.log(error.response,'-------');//可以拿到后端返回的信息
      });

 

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐