triggerRef()
强制触发与ref关联的effect效应。这通常在对浅层参考的内部值进行深度突变后使用。
类型
function triggerRef(ref: ShallowRef): void
例子
const shallow =shallowRef ({ greet: 'Hello, world' }) // Logs "Hello, world" once for the first run-through watchEffect(() => { console.log(shallow.value.greet) }) // This won't trigger the effect because the ref is shallow shallow.value.greet = 'Hello, universe' // Logs "Hello, universe" triggerRef(shallow)