Skip to content

Commit

Permalink
http 错误
Browse files Browse the repository at this point in the history
Former-commit-id: 2dd211d2d907008d183137f70427aa9e09911d3a [formerly 2dd211d2d907008d183137f70427aa9e09911d3a [formerly 2dd211d2d907008d183137f70427aa9e09911d3a [formerly 2dd211d2d907008d183137f70427aa9e09911d3a [formerly 3513cac [formerly 9d47a62c0bf21043a3a033ca2986dd7e0e498fde]]]]]
Former-commit-id: 19f33fa
Former-commit-id: 8817aeb
Former-commit-id: 4a03ffc59182705c1e32cc39a3b58bd4f99cab3f [formerly c3df7a16c661750c70f9d958b77e41859741cef2]
Former-commit-id: 507e7b5131fd2c7ebb015e2da0c0ed38699b7aaa
Former-commit-id: a3d6f974fee73c06f92f4bc834f21f4b844cc370
Former-commit-id: 10afc53093bf44b398b5f8f7560b9b9cd231d05e
Former-commit-id: 4707b2df138c81c69c09dae73ab0f16c429336de
Former-commit-id: 8fdd5a268b3fb3150b8ac9b50e9c507c2bc2c07e
  • Loading branch information
FairyEver committed Aug 27, 2018
1 parent 217c238 commit c0d0527
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions docs/zh/sys-ajax/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,6 @@ VUE_APP_API=/api-dev/
service.interceptors.response.use(
response => {
// 成功返回数据,在这里判断和后台约定的状态标识
},
error => {
// 发生 http 错误,在这里判断状态码
}
)
```
Expand All @@ -117,6 +114,15 @@ service.interceptors.response.use(

如果需要针对某个 http 错误指定处理方法,应该在响应拦截器中第二个参数中添加对应的代码。

``` js
service.interceptors.response.use(
response => {},
error => {
// 发生 http 错误,在这里判断状态码
}
)
```

### 不返回 code

在默认的设置中,如果您的接口没有返回 code 字段,将不会进行状态(非 http 状态,而是和后台约定好的状态类型)判断,直接返回 axios 请求返回的数据。
Expand Down

0 comments on commit c0d0527

Please sign in to comment.