vue3 watchEffect
<el-button type="primary" plain round @click="stop">stop</el-button> const stop = watchEffect((onInvalidate) => { console.log(massage.value); onInvalidate(()=>{ console.log('2'); //这个回先执行,log 2,然后log massage.value
}),{
flush:'post',
onTrack?: (event: DebuggerEvent) => void 调试bug用
onTrigger?: (event: DebuggerEvent) => void
} }) flush:'post' //添加flush:'post' 组件更新后执行对应方法,sync 强制效果始终同步触发 pre组件更新前执行