function fetchData () {
//获取cancel的token
const CancelToken = axios.CancelToken;
const source = CancelToken.source();
setTimeout(() => {
//调用取消
source.cancel();
}, 10);
this.$http.get(
`list`,
{
//携带取消标识
cancelToken: source.token,
//上传进度条
onUploadProgress (progressEvent) {
console.log(progressEvent.loaded);
console.log(progressEvent.total);
},
params: {
'page': 1,
}
}
);
}
网友评论