vue2 axios封装dispatchRequest.js?fe7b:18 Uncaught (in promise) TypeError: Cannot read properties of un

vue封装中遇到这样的问题:

dispatchRequest.js?fe7b:18 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'cancelToken')
    at throwIfCancellationRequested (dispatchRequest.js?fe7b:18:1)
    at Axios.dispatchRequest (dispatchRequest.js?fe7b:35:1)

原因:

主要是在请求拦截器中,没有返回config造成的

解决方法:在拦截器处理完后,返回config,如下 

vue2 axios封装dispatchRequest.js?fe7b:18 Uncaught (in promise) TypeError: Cannot read properties of un_第1张图片

 

你可能感兴趣的:(javascript,vue.js,前端)