原文:TypeError: Cannot read property 'setData' of undefined

刚刚入手小程序没多久 今天在写小程序时用到 this.setData时会报错 这个让我想起了 react this.setState 一般在react中写点击事件的时候 都喜欢 这样写 onClick this.bindClick.bind this OKOK 破案了 this 指向问题 解决了 但是这样写属实是麻烦 所以ES 箭头函数走起吧 ...

2020-07-02 14:39 0 852 推荐指数:

查看详情

 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM