1 watch(侦听一个或多个响应式数据源,并在数据源变化时调用所给的回调函数。比如ref或reactive声明的变量)
import {watch,reactive} from "vue"; const state = { name:1 } watch(state.name,(newValue,OldValue) => { console.log(newValue); console.log(OldValue); }) 2 watchEffect