this.axios.get('xxx').then(response => {

}).catch(error => error.response)
打印error会出现下面这样的内容,不是我们想要的。

Error: Request failed with status code 403

at createError (createError.js:16)
at settle (settle.js:18)
at XMLHttpRequest.handleLoad (xhr.js:77)


打印error.response即可

本文固定链接: http://www.js-code.com/vue-js/vue-js_24693.html