useDebounce ​
A hook that deal with the debounced value.
Code demonstration ​
API ​
typescript
const debouncedValue = useDebounce(
value: any,
options?: Options
);Params ​
| Property | Description | Type | Default |
|---|---|---|---|
| value | The value to debounce. | Ref<any> | - |
| options | Config for the debounce behaviors. | Options | - |
Options ​
| Property | Description | Type | Default |
|---|---|---|---|
| wait | The number of milliseconds to delay. | number|Ref<number> | 1000 |
| leading | Specify invoking on the leading edge of the timeout. | boolean|Ref<boolean> | false |
| trailing | Specify invoking on the trailing edge of the timeout. | boolean|Ref<boolean> | true |
| maxWait | The maximum time func is allowed to be delayed before it’s invoked. | number|Ref<number> | - |
Remark
options.waitsupport dynamic changes.options.leadingsupport dynamic changes.options.trailingsupport dynamic changes.options.maxWaitsupport dynamic changes.