axios 可以被cancel

```js

var CancelToken = axios.CancelToken;

var source = CancelToken.source(); 

axios.get('/user/12345', {cancelToken: source.token}).catch(function(thrown){if(axios.isCancel(thrown)) {console.log('Request canceled', thrown.message); }else{// handle error}});// cancel the request (the message parameter is optional)


source.cancel('Operation canceled by the user.');

```

你可能感兴趣的:(axios 可以被cancel)