From 978cb2289cb47f76f4744c3827c934ed6bd291d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=91=E6=B3=A5?= <1656081615@qq.com> Date: Sun, 19 Nov 2023 21:56:48 +0800 Subject: [PATCH] docs: add note for pollingInterval (#2358) --- packages/hooks/src/useRequest/doc/polling/polling.en-US.md | 1 + packages/hooks/src/useRequest/doc/polling/polling.zh-CN.md | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/hooks/src/useRequest/doc/polling/polling.en-US.md b/packages/hooks/src/useRequest/doc/polling/polling.en-US.md index 495b46706c..56c69db578 100644 --- a/packages/hooks/src/useRequest/doc/polling/polling.en-US.md +++ b/packages/hooks/src/useRequest/doc/polling/polling.en-US.md @@ -58,4 +58,5 @@ You can experience the effect through the following example. - `options.pollingInterval`, `options.pollingWhenHidden` support dynamic changes. - If you set `options.manual = true`, the initialization will not start polling, you need start it by `run/runAsync`. +- If the `pollingInterval` changes from 0 to a value greater than 0, polling will not start automatically, and you need start it by `run/runAsync`. - The polling logic is to wait for `pollingInterval` time after each request is completed, and then initiate the next request. diff --git a/packages/hooks/src/useRequest/doc/polling/polling.zh-CN.md b/packages/hooks/src/useRequest/doc/polling/polling.zh-CN.md index b043adf048..b124f49d02 100644 --- a/packages/hooks/src/useRequest/doc/polling/polling.zh-CN.md +++ b/packages/hooks/src/useRequest/doc/polling/polling.zh-CN.md @@ -50,7 +50,7 @@ const { data, run, cancel } = useRequest(getUsername, { | 参数 | 说明 | 类型 | 默认值 | | ---------------------- | ------------------------------------------------------------------------------------------------------ | --------- | ------ | -| pollingInterval | 轮询间隔,单位为毫秒。如果值大于 0,则启动轮询模式。 | `number` | `0` | +| pollingInterval | 轮询间隔,单位为毫秒。如果值大于 0,则处于轮询模式。 | `number` | `0` | | pollingWhenHidden | 在页面隐藏时,是否继续轮询。如果设置为 false,在页面隐藏时会暂时停止轮询,页面重新显示时继续上次轮询。 | `boolean` | `true` | | pollingErrorRetryCount | 轮询错误重试次数。如果设置为 -1,则无限次 | `number` | `-1` | @@ -58,4 +58,5 @@ const { data, run, cancel } = useRequest(getUsername, { - `options.pollingInterval`、`options.pollingWhenHidden` 支持动态变化。 - 如果设置 `options.manual = true`,则初始化不会启动轮询,需要通过 `run/runAsync` 触发开始。 +- 如果设置 `pollingInterval` 由 `0` 变成 `大于 0` 的值,不会启动轮询,需要通过 `run/runAsync` 触发开始。 - 轮询原理是在每次请求完成后,等待 `pollingInterval` 时间,发起下一次请求。