Skip to content

watchOnce

类别
导出大小
123 B
最近修改
2 days ago

使用 { once: true } 观察值的简写。一旦回调触发一次,监视器将会停止。 完整详情请参见 Vue 的文档

🌐 Shorthand for watching value with { once: true }. Once the callback fires once, the watcher will be stopped. See Vue's docs for full details.

用法

🌐 Usage

类似于 watch,但是有 { once: true }

🌐 Similar to watch, but with { once: true }

ts
import { 
watchOnce
} from '@vueuse/core'
watchOnce
(source, () => {
// triggers only once
console
.
log
('source changed!')
})