vue3-request 1.0.19 → 1.0.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +34 -1
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1 +1,34 @@
1
- 一个Vue3的异步请求处理库,旨在简化你的异步操作和api调用
1
+ ## ⚡ 快速安装
2
+
3
+ ```bash [pnpm]
4
+ pnpm add vue3-request
5
+ ```
6
+
7
+ ## 🚀 5 分钟上手
8
+
9
+ ```vue
10
+ <template>
11
+ <div>
12
+ <div v-if="loading">加载中...</div>
13
+ <div v-else-if="error">{{ error.message }}</div>
14
+ <div v-else>{{ data }}</div>
15
+ <button @click="refresh">刷新</button>
16
+ <button @click="abort">中止</button>
17
+ </div>
18
+ </template>
19
+
20
+ <script setup lang="ts">
21
+ import { useRequest } from "vue3-request";
22
+
23
+ const getUserInfo = async () => {
24
+ const response = await fetch("/api/userInfo", {
25
+ signal: signal.value,
26
+ });
27
+ return response.json();
28
+ };
29
+
30
+ // 一行代码搞定状态管理
31
+ const { data, error, loading, signal, refresh, abort } =
32
+ useRequest(getUserInfo);
33
+ </script>
34
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue3-request",
3
- "version": "1.0.19",
3
+ "version": "1.0.20",
4
4
  "type": "module",
5
5
  "description": "A Vue3 asynchronous request processing library, designed to simplify your asynchronous operations and API calls.",
6
6
  "main": "dist/vue3-request.es.js",