SOURCE

console 命令行工具 X clear

                    
>
console
const burck = new Set()

const data = {
    text: 'hello'
}

const obj = new Proxy(data,{
  get(target, key){
     burck.add(effuct)
     return target[key]
  },
  set(target, key , value) {
      target[key] = value
      burck.forEach(fn => fn())
      return true
  }
})

function effuct() {
    document.querySelector('#app').textContent = obj.text
}
effuct()

const btn = document.querySelector('#btn')

btn.addEventListener('click', () ={
    obj.text += Math.random(2)
})


setTimeout(()=>{
    obj.text = 'hello vue'
},1500)



<button id='btn'>点我更新节点</button>
<div id="app"></div>