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: src/useRequest/index.en-US.md
+35-18Lines changed: 35 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -69,6 +69,22 @@ The API is different from [ahooks](https://ahooks.js.org/hooks/async).
69
69
desc="Setting `options.loadingDelay` can specifies a delay in milliseconds for loading (prevent flush).">
70
70
</demo>
71
71
72
+
### Ready
73
+
74
+
<demo src="./demo/demo-ready.vue"
75
+
language="vue"
76
+
title="Ready"
77
+
desc="In the automatic mode of manual=false, every time ready changes from false to true, a request will be automatically executed with the parameter options.defaultParams">
78
+
</demo>
79
+
80
+
### Ready (manual = true)
81
+
82
+
<demo src="./demo/demo-ready-manual-true.vue"
83
+
language="vue"
84
+
title="Ready"
85
+
desc="When manual=true manual request mode, as long as ready=false, the request triggered by run will not be executed">
| manual | <ul><li> The default `false`. That is, the service is automatically executed during initialization.</li><li>If set to `true`, you need to call `run` manually to trigger execution. </li></ul> |`boolean`| false |
| onSuccess | <ul><li> Triggered when the service resolved, the parameters are `data` and`params` </li><li> If `formatResult` is present,`data` is the formatted data.</li></ul> |`(data: any, params: any[]) => void`| - |
133
-
| onError | Triggered when the service reports an error. The parameters are `error` and`params`. |`(error: Error, params: any[]) => void`| - |
134
-
| defaultParams | If `manual = false`, the default parameters when run is executed automatically, |`any[]`| - |
135
-
| loadingDelay | Set delay time for display loading to avoid flicker |`number`| - |
136
-
| pollingInterval | Polling interval in milliseconds. After setting, it will enter polling mode and trigger `run` periodically. |`number`| - |
137
-
| pollingSinceLastFinished | <ul><li> Whether start next polling request since last request finished. Default is `true`. </li><li> If set `false`, request will start every `pollingInterval` time. </li></ul> |`boolean`| true |
138
-
| pollingWhenHidden | <ul><li> Whether to continue polling when the page is hidden. Default is `true`, that is, polling will not stop </li><li> If set to `false`, polling is temporarily stopped when the page is hidden, and the last polling is continued when the page is redisplayed </li></ul> |`boolean`|`true`|
139
-
| debounceInterval | debounce interval, the unit is millisecond. After setting, request to enter debounce mode. |`number`| - |
140
-
| loadingWhenDebounceStart | Whether set loading to `true` when the `run` function starts to execute. |`boolean`|`true`|
141
-
| throttleInterval | throttle interval, the unit is millisecond. After setting, request to enter throttle mode. |`number`| - |
142
-
| throwOnError | If the service errors, the error will only be logged. If you want an error to be thrown, pass the throwOnError: true |`boolean`|`false`|
143
-
| refreshOnWindowFocus `v0.9`| The request will be re-initiated when the screen is refocused or revisible. |`boolean`|`false`|
144
-
| refreshDeps `v0.9`| RefreshDeps changes will trigger the service to re-execute. |`WatchSource[]`|`[]`|
| manual | <ul><li> The default `false`. That is, the service is automatically executed during initialization.</li><li>If set to `true`, you need to call `run` manually to trigger execution. </li></ul> |`boolean`| false |
| onSuccess | <ul><li> Triggered when the service resolved, the parameters are `data` and`params` </li><li> If `formatResult` is present,`data` is the formatted data.</li></ul> |`(data: any, params: any[]) => void`| - |
149
+
| onError | Triggered when the service reports an error. The parameters are `error` and`params`. |`(error: Error, params: any[]) => void`| - |
150
+
| defaultParams | If `manual = false`, the default parameters when run is executed automatically, |`any[]`| - |
151
+
| loadingDelay | Set delay time for display loading to avoid flicker |`number`| - |
152
+
| pollingInterval | Polling interval in milliseconds. After setting, it will enter polling mode and trigger `run` periodically. |`number`| - |
153
+
| pollingSinceLastFinished | <ul><li> Whether start next polling request since last request finished. Default is `true`. </li><li> If set `false`, request will start every `pollingInterval` time. </li></ul> |`boolean`| true |
154
+
| pollingWhenHidden | <ul><li> Whether to continue polling when the page is hidden. Default is `true`, that is, polling will not stop </li><li> If set to `false`, polling is temporarily stopped when the page is hidden, and the last polling is continued when the page is redisplayed </li></ul> |`boolean`|`true`|
155
+
| debounceInterval | debounce interval, the unit is millisecond. After setting, request to enter debounce mode. |`number`| - |
156
+
| loadingWhenDebounceStart | Whether set loading to `true` when the `run` function starts to execute. |`boolean`|`true`|
157
+
| throttleInterval | throttle interval, the unit is millisecond. After setting, request to enter throttle mode. |`number`| - |
158
+
| throwOnError | If the service errors, the error will only be logged. If you want an error to be thrown, pass the throwOnError: true |`boolean`|`false`|
159
+
| refreshOnWindowFocus `v0.9`| The request will be re-initiated when the screen is refocused or revisible. |`boolean`|`false`|
160
+
| refreshDeps `v0.9`| RefreshDeps changes will trigger the service to re-execute. |`WatchSource[]`|`[]`|
161
+
| ready `v0.12.4`| Is the current request ready |`Ref<Boolean>`|`ref(true)`|
0 commit comments