You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+49-51Lines changed: 49 additions & 51 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,24 +6,24 @@ English | [中文](./README-zh_TW.md)
6
6
7
7
## Introduction
8
8
9
-
Vue composition API for automatic data fetching. With `conditions`as the core. Easily control and sync to URL query string by `conditions`
9
+
Data fetching with Vue Composition API. Power of `conditions`to easily control and sync to the URL query string.
10
10
> requires Node.js 12.0.0 or higher.
11
11
12
12
## Features
13
13
14
-
✔ Automatically fetch data whenever `conditions`changes<br>
15
-
✔ `null``undefined``[]``''`will be automatically filtered out before sending the request<br>
16
-
✔ Refreshing the page will automatically initialize `conditions` according to the query string of the URL, and will automatically correspond to the type (string, number, array, date )<br>
17
-
✔ Whenever `conditions`changes, the URL query string will be automatically synchronized, and the previous page and next page will work normally<br>
18
-
✔ Avoid `race condition`, ensure requests are first in, first out, and can also avoid repeated requests<br>
19
-
✔ Do Dependent Request before updating `data`<br/>
20
-
✔ Easily handle paging needs, simply customize your own paging logic<br/>
21
-
✔ Automatically re-request data when web page is refocused or network disconnection resumes<br/>
22
-
✔ Support polling, the polling period can be adjusted dynamically<br/>
23
-
✔ The caching mechanism allows data to be rendered faster without waiting for loading animations<br/>
24
-
✔ No need to wait for the return result, you can manually change `data` to make the user experience better<br/>
25
-
✔ TypeScript support.<br/>
26
-
✔ Works for Vue 2 & 3 by the power of [vue-demi](https://github.com/vueuse/vue-demi)
14
+
✔ Automatically fetch data whenever `conditions`change.<br>
15
+
✔ Automatically filter out `null`,`undefined`,`[]`, and `''` before sending the request.<br>
16
+
✔ Refresh the page to automatically initialize `conditions` according to the query string of the URL, and correspond to the type (string, number, array, date).<br>
17
+
✔ Whenever `conditions`change, the URL query string will be automatically synchronized, and the previous page and next page will work normally.<br>
18
+
✔ Avoid race conditions, ensure requests are first in, first out, and can also avoid repeated requests.<br>
19
+
✔ Perform dependent requests before updating data.<br/>
20
+
✔ Easily handle paging needs by customizing your own paging logic.<br/>
21
+
✔ Automatically refetch data when the web page is refocused or network disconnection resumes.<br/>
22
+
✔ Support polling, with the polling period adjustable dynamically.<br/>
23
+
✔ The caching mechanism allows `data` to be rendered faster without waiting for loading animations.<br/>
24
+
✔ No need to wait for the return result; you can manually change `data` to improve the user experience.<br/>
25
+
✔ TypeScript support.<br/>
26
+
✔ Works for Vue 2 & 3 through the power of [vue-demi](https://github.com/vueuse/vue-demi).
This is a simple example for `vue-next` and `vue-router-next`
96
+
You can start by creating a fetcher function using the native `fetch` or libraries like `Axios`. Then, import the `useConditionWatcher` function and start using it. Here's an example:
97
97
98
-
First you need to create a fetcher function, use the native `fetch` or libs like Axios. Then import `useConditionWatcher` and start using it.
You can use the value of `data`, `error`, and `loading` to determine the current state of the request.
132
+
The `useConditionWatcher` function returns an object with three properties: `data`, `error`, and `loading`. You can use these values to determine the current state of the request.
135
133
136
-
When the `conditions.name`value changes, will fire the `lifecycle` to fetching data again.
134
+
When the value of `conditions.name` changes, `useConditionWatcher` will automatically refetch the data.
137
135
138
-
Use `config.history`of sync to `sync: router`. Will store the conditions within the URL query string every time conditions change.
136
+
You can use the `config.history`option to sync the conditions object with the router. This will store the conditions object within the URL query string every time it changes.
Copy file name to clipboardExpand all lines: package.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
{
2
2
"name": "vue-condition-watcher",
3
3
"version": "2.0.0-beta.3",
4
-
"description": "Vue composition API for automatic data fetching. With conditions as the core. Easily control and sync to URL query string by conditions",
4
+
"description": "Data fetching with Vue Composition API. Power of conditions to easily control and sync to the URL query string.",
0 commit comments