pnpm add @baic/yolk
// .umirc.ts
import defineConfig from '@baic/yolk/lib/define-config';
export default defineConfig({});
| 参数 | 说明 | 类型 | 默认值 |
| :-: | :-: | :-: | :-: | --- |
| baseUrl | 基础 Url | string | - |
| suffix | 默认后缀名,如果 url 内部包含不添加 | string | - |
| randomStringName | 随机数参数名 | string | _
|
| shallowTrim | 参数浅层次去掉前后空格 | boolean | true |
| deepTrim | 参数深层次去掉前后空格 | boolean | false |
| onStart | 请求前调用,返回请求参数 | function | - |
| onEnd | 请求完成调用 | function | - |
| onFail | 请求失败调用 | function | - |
| onError | 请求发生错误调用,返回 response 对象 | function | - |
| onInterceptorCatch | 判断返回结果符合的 Promise | function | - |
| transformResult | 转换返回 response.data | function | - |
| loading | 是否开启默认 Loading | boolean | true |
| headers | 扩展为可异步函数返回 header | object | function | - |