From dabadeba39a408d410e67c6ffb6cb085449658d0 Mon Sep 17 00:00:00 2001 From: wtto00 Date: Fri, 20 Sep 2024 00:39:19 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E6=96=87=E4=BB=B6README.md=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E5=99=A8=E8=87=AA=E5=8A=A8=E6=A0=BC=E5=BC=8F=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 56 +++++++++++++++++++++++++++---------------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index 46a691d..3f8e403 100644 --- a/README.md +++ b/README.md @@ -791,7 +791,7 @@ un.get('/user/12345', { }); ``` -如果你追求语义化,可以使用导出的和挂载的状态码、[statuses](https://github.com/esm-ts/statuses-es)、[http-status-codes](https://github.com/prettymuchbryce/http-status-codes) 或 [node-http-status](https://github.com/adaltas/node-http-status)。 +如果你追求语义化,可以使用导出的和挂载的状态码、[statuses-es](https://github.com/esm-ts/statuses-es)、[http-status-codes](https://github.com/prettymuchbryce/http-status-codes) 或 [node-http-status](https://github.com/adaltas/node-http-status)。 ```typescript import { un, HttpStatusCode } from '@uni-helper/uni-network'; @@ -1143,34 +1143,34 @@ import { useUn } from '@uni-helper/uni-network/composables'; 如果你因为某些原因坚持使用 `axios`,你可以查看 [@uni-helper/axios-adapter](https://github.com/uni-helper/axios-adapter) 获取 `adapter` 支持。 以下是 `@uni-helper/uni-network` 与其它一些库的比较。如果你发现这里信息已经过时,欢迎提交 ISSUE 或 PR。 -| | `axios` | `luch-request` | `uni-ajax` | `@uni-helper/uni-network` | +| | `axios` | `luch-request` | `uni-ajax` | `@uni-helper/uni-network` | | ---------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| 基本信息 | [![npm](https://img.shields.io/npm/v/axios)](https://www.npmjs.com/package/axios) [![npm](https://img.shields.io/npm/dw/axios)](https://www.npmjs.com/package/axios) | [![npm](https://img.shields.io/npm/v/luch-request)](https://www.npmjs.com/package/luch-request) [![npm](https://img.shields.io/npm/dw/luch-request)](https://www.npmjs.com/package/luch-request) | [![npm](https://img.shields.io/npm/v/uni-ajax)](https://www.npmjs.com/package/uni-ajax) [![npm](https://img.shields.io/npm/dw/uni-ajax)](https://www.npmjs.com/package/uni-ajax) | [![npm](https://img.shields.io/npm/v/@uni-helper/uni-network)](https://www.npmjs.com/package/@uni-helper/uni-network) [![npm](https://img.shields.io/npm/dw/@uni-helper/uni-network)](https://www.npmjs.com/package/@uni-helper/uni-network) | -| 开发语言 | JavaScript | JavaScript | JavaScript | TypeScript | -| 类型支持 | `index.d.ts`(没有考虑 `uni-app`) | `index.d.ts`(泛型支持较差) | `index.d.ts` | 包含 | -| 运行环境 | 浏览器和 `Node.js` | `uni-app` | `uni-app` | `uni-app` | -| `Promise` | √ | √ | √ | √ | -| `uni_modules` | × | √ | √ | × | -| `npm` 包 | √ | √ | √ | √ | -| 实例化 | √ | √ | √ | √ | -| 请求说明 | √ | √ | √ | √ | -| 请求头 headers | `AxiosHeaders` | 普通对象 | 普通对象 | 普通对象 | -| 请求参数 params | `AxiosURLSearchParams` | 普通对象 | 普通对象 | 普通对象或 `URLSearchParams` 对象 | -| 请求转换 `transformRequest` | √ | × | × | × | -| 响应说明 | √ | × | √ | √ | -| 响应转换 `transformResponse` | √ | × | × | × | -| 任务说明 | ×(没有考虑 `uni-app`  任务) | × | √(只有 `requestTask`  说明) | √(只有简单说明) | -| 适配器 | √(内置 `xhr` 和 `http`) | × | √ | √ | -| `uni.request` | ×(自行开发,还需要覆写类型) | √ | √ | √ | -| `uni.downloadFile` | ×(自行开发,还需要覆写类型) | √ | ×(自行开发,还需要覆写类型) | √ | -| `uni.uploadFile` | ×(自行开发,还需要覆写类型) | √ | ×(自行开发,还需要覆写类型) | √ | -| 请求拦截器 | √ | √ | √ | √ | -| 响应拦截器 | √ | √ | √ | √ | -| 配置说明 | √ | √ | √ | √ | -| 取消请求说明 | √ | × | √ | √ | -| 错误处理说明 | √ | × | √ | √ | -| 测试 | 完善 | 部分 | 无 | 部分 | -| 使用示例 | √ | √ | √ | √ | +| 基本信息 | [![npm](https://img.shields.io/npm/v/axios)](https://www.npmjs.com/package/axios) [![npm](https://img.shields.io/npm/dw/axios)](https://www.npmjs.com/package/axios) | [![npm](https://img.shields.io/npm/v/luch-request)](https://www.npmjs.com/package/luch-request) [![npm](https://img.shields.io/npm/dw/luch-request)](https://www.npmjs.com/package/luch-request) | [![npm](https://img.shields.io/npm/v/uni-ajax)](https://www.npmjs.com/package/uni-ajax) [![npm](https://img.shields.io/npm/dw/uni-ajax)](https://www.npmjs.com/package/uni-ajax) | [![npm](https://img.shields.io/npm/v/@uni-helper/uni-network)](https://www.npmjs.com/package/@uni-helper/uni-network) [![npm](https://img.shields.io/npm/dw/@uni-helper/uni-network)](https://www.npmjs.com/package/@uni-helper/uni-network) | +| 开发语言 | JavaScript | JavaScript | JavaScript | TypeScript | +| 类型支持 | `index.d.ts`(没有考虑 `uni-app`) | `index.d.ts`(泛型支持较差) | `index.d.ts` | 包含 | +| 运行环境 | 浏览器和 `Node.js` | `uni-app` | `uni-app` | `uni-app` | +| `Promise` | √ | √ | √ | √ | +| `uni_modules` | × | √ | √ | × | +| `npm` 包 | √ | √ | √ | √ | +| 实例化 | √ | √ | √ | √ | +| 请求说明 | √ | √ | √ | √ | +| 请求头 headers | `AxiosHeaders` | 普通对象 | 普通对象 | 普通对象 | +| 请求参数 params | `AxiosURLSearchParams` | 普通对象 | 普通对象 | 普通对象或 `URLSearchParams` 对象 | +| 请求转换 `transformRequest` | √ | × | × | × | +| 响应说明 | √ | × | √ | √ | +| 响应转换 `transformResponse` | √ | × | × | × | +| 任务说明 | ×(没有考虑 `uni-app`  任务) | × | √(只有 `requestTask`  说明) | √(只有简单说明) | +| 适配器 | √(内置 `xhr` 和 `http`) | × | √ | √ | +| `uni.request` | ×(自行开发,还需要覆写类型) | √ | √ | √ | +| `uni.downloadFile` | ×(自行开发,还需要覆写类型) | √ | ×(自行开发,还需要覆写类型) | √ | +| `uni.uploadFile` | ×(自行开发,还需要覆写类型) | √ | ×(自行开发,还需要覆写类型) | √ | +| 请求拦截器 | √ | √ | √ | √ | +| 响应拦截器 | √ | √ | √ | √ | +| 配置说明 | √ | √ | √ | √ | +| 取消请求说明 | √ | × | √ | √ | +| 错误处理说明 | √ | × | √ | √ | +| 测试 | 完善 | 部分 | 无 | 部分 | +| 使用示例 | √ | √ | √ | √ | ## 资源