同一个接口,第二次调用时会终止第一次调用,哪怕第一次调用还未结束
var that = this;
if(typeof this.source === 'function'){
this.source('终止请求')
}
axios({
method: "",
url: "",
cancelToken: new axios.CancelToken(function(c) {
that.source = c;
})
}).then((res) => {}).catch(err => {})