const { reactive, effect } = VueObserver
const origin = {
count: 0
}
# 1. 将数据代理变为响应式数据
const state = reactive(origin)
# 2. 依赖响应式数据的 动作:Dep依赖
const fn = () => {
const count = state.count
console.log(`set count to ${count}`)
}
effect(fn) // 用effect包裹一下
# 3. 修改data,可以看到fn被执行
控制台执行 state.count++
输出 set count to 1