pull/1/head
954270063@qq.com 2020-04-21 14:28:24 +08:00
parent de08a1346b
commit 5c923a4294
1 changed files with 12 additions and 1 deletions

View File

@ -223,7 +223,7 @@ axios('/test', {
}); });
``` ```
### 自定义错误处理`config.errorHandler` #### 自定义错误处理`config.errorHandler`
可以添加到默认配置中,统一处理错误 可以添加到默认配置中,统一处理错误
@ -489,3 +489,14 @@ const instance = new axios.Axios({
instance.get('/test'); instance.get('/test');
``` ```
### `axios.isCancel`
可以用来判断当前错误是否来自取消请求
```typescript
axios('/test').catch((error) => {
if(axios.isCancel(error)){
// 请求被取消
}
});
```