shallowRef & triggerRef Shaun_Zhao 2021-10-10 941 阅读1分钟 setup() { const shallow = shallowRef({ foo: 'hello world' }); watchEffect(() => { console.log(shallow.value.foo); }); // 这不会触发作用 (effect),因为 ref 是浅层的 shallow.value.foo = 'hello vite'; triggerRef(shallow); }