abort all Axios requests when change route use vue-router
问题 how can i abort / cancel Axios request before complete when i change route use vue-router. when user open page it automatically send axios request to get some data, but user don't waiting to get response then he is changing route by vue-router it will be a lot of Axios requests so is there any solve to my problem 回答1: Basically you have to generate a global cancel token const CancelToken = axios.CancelToken; const source = CancelToken.source(); and use it in all your requests by passing it in