原文: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