useRafFn
每个 requestAnimationFrame
上调用函数。具有暂停和恢复控制。
¥Call function on every requestAnimationFrame
. With controls of pausing and resuming.
示例
用法
¥Usage
js
import { useRafFn } from '@vueuse/core'
import { shallowRef } from 'vue'
const count = shallowRef(0)
const { pause, resume } = useRafFn(() => {
count.value++
console.log(count.value)
})