Skip to content
On this page

useThrottle

用来处理节流值的 Hook。

代码演示

基础用法

API

javascript
const modelValue = useThrottle<T>(
  defaultValue: T,
  options?: useThrottleOptions<T>
)
const modelValue = useThrottle<T>(
  defaultValue: T,
  options?: useThrottleOptions<T>
)

Params

参数说明类型默认值
defaultValue必填,默认值 T-
options可选,详见下面的 useThrottleOptionsuseThrottleOptions-

useThrottleOptions

参数说明类型默认值
change可选,状态发生改变触发(value: T) => void-
wait可选,节流需要延迟的毫秒数number250
leading可选,指定在延迟开始前调用booleantrue
trailing可选,指定在延迟结束后调用booleantrue