Appearance
useThrottleFn
▸ useThrottleFn(fn
, wait?
, options?
): UseThrottleFnWithLockResult
使用节流函数实现的 Vue Hook,用于在组件中创建一个经过节流处理的函数。
参数
Name | Type | Default value | Description |
---|---|---|---|
fn | Function | undefined | 要执行的函数。 |
wait? | number | 3000 | 节流等待的毫秒数,在该时间间隔内只会执行一次函数。 |
options? | any | undefined | 节流配置选项。 |
返回值
- 一个包含运行函数、取消、立即执行和判断是否运行中的对象。
Throws
如果传入的 fn 不是一个函数,则抛出 TypeError。