useDebouncedRefHistory
具有防抖过滤器的 useRefHistory
的简写。
示例
用法
此函数在计数器值开始变化时,会在 1000ms 后对其进行快照。
ts
import { useDebouncedRefHistory } from '@vueuse/core'
import { ref } from 'vue'
const counter = ref(0)
const { history, undo, redo } = useDebouncedRefHistory(counter, { deep: true, debounce: 1000 })
类型声明
typescript
/**
* [useRefHistory](https://vueuse.org/useRefHistory) 的防抖实现
*
* @see https://vueuse.org/useDebouncedRefHistory
* @param source
* @param options
*/
export declare function useDebouncedRefHistory<Raw, Serialized = Raw>(
source: Ref<Raw>,
options?: Omit<UseRefHistoryOptions<Raw, Serialized>, "eventFilter"> & {
debounce?: MaybeRefOrGetter<number>
},
): UseRefHistoryReturn<Raw, Serialized>
源码
贡献者
Anthony Fu
一纸忘忧
Roman Harmyder
OrbisK
Anthony Fu
wheat
更新日志
v12.0.0-beta.1
on 11/21/2024v10.0.0-beta.4
on 4/13/20234d757
- feat(types)!: rename MaybeComputedRef
to MaybeRefOrGetter