useThrottledRefHistory
Category
Export Size
1.73 kB
Last Changed
15 minutes ago
Related
带有节流过滤器的 useRefHistory
的简写。
Demo
用法
该函数在计数器的值更改后立即获取第一个快照,并在延迟 1000ms 后获取第二个快照。
ts
import { useThrottledRefHistory } from '@vueuse/core'
import { ref } from 'vue'
const counter = ref(0)
const { history, undo, redo } = useThrottledRefHistory(counter, { deep: true, throttle: 1000 })
类型声明
typescript
export type UseThrottledRefHistoryOptions<Raw, Serialized = Raw> = Omit<
UseRefHistoryOptions<Raw, Serialized>,
"eventFilter"
> & {
throttle?: MaybeRef<number>
trailing?: boolean
}
export type UseThrottledRefHistoryReturn<
Raw,
Serialized = Raw,
> = UseRefHistoryReturn<Raw, Serialized>
/**
* 带节流功能的 useRefHistory 的简写。
*
* @see https://vueuse.org/useThrottledRefHistory
* @param source
* @param options
*/
export declare function useThrottledRefHistory<Raw, Serialized = Raw>(
source: Ref<Raw>,
options?: UseThrottledRefHistoryOptions<Raw, Serialized>,
): UseThrottledRefHistoryReturn<Raw, Serialized>
Source
贡献者
Anthony Fu
丶远方
Roman Harmyder
Anthony Fu
Jelf
Bodo Graumann
wheat