场景:小邹最近在使用axios时碰到一个问题,就是我想在特性条件时取消请求,以便减少不必要的前后接口交互。我们知道ajax取消请求的方式有两种:一种是通过设置时间,超时自动断开,另一种我们可以调用XMLHttpRequest对象上的abort方法。那我们在使用axios过程中该如何取消请求呢?小邹翻了一下官方的文档是这么说的:You can cancel a request using a cancel token.The axios cancel token API is based on the withdrawn cancelable promises proposal. You can create a cancel token using the CancelToken.source factory as shown below: