其他分享
首页 > 其他分享> > 响应式错误示范

响应式错误示范

作者:互联网

    const obj = {
      name: ''
    }
    Object.defineProperty(obj, 'name', {
      get () {
        log('你正在访问那么')
        return this.name
      },
      set (val) {
        log('你在改变')
        log('val:', val)
        this.name = val
      }
    })
    const changeObj = () => {
      obj.name = 'hhcsa'
      log('1')
    }

  

标签:obj,log,val,get,错误,示范,响应,const,name
来源: https://www.cnblogs.com/hhvcg/p/15333058.html