收藏
回答

事件绑定使用学习中,显示this.setDate is not a function怎么办?

<button type="primary" bindtap="btnTapHandler">按钮</button>

<button type="primary" bindtap="CountChange">+1</button>


Page({

  data: {

    count:0

  },

  // 定义按钮的事件处理函数

  btnTapHandler(e){

    console.log(e)

  },

  CountChange(e){

    

    this.setDate({

      count:this.data.count +1 

    })

  }

})


VM1168 WAService.js:2 TypeError: this.setDate is not a function

    at Vi.CountChange (event.js? [sm]:12)

    at Object.i.safeCallback (VM1168 WAService.js:2)

    at VM1168 WAService.js:2

    at Sr (VM1168 WAService.js:2)

    at VM1168 WAService.js:2

    at b (VM1168 WAService.js:2)

    at VM1168 WAService.js:2

    at VM1168 WAService.js:2

    at s (VM8 asdebug.js:1)

    at c (VM8 asdebug.js:1)(env: Windows,mp,1.05.2203070; lib: 2.23.0)

回答关注问题邀请回答
收藏

1 个回答

登录 后发表内容