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