原文:Uncaught (in promise) TypeError:的錯誤

錯誤 創建一個vue實例,在data定義一些變量,如activityTime。 在methods里面用了axios發送請求。 在then的回調里使用this.activityTime 報錯 原因。then沒有跟promise實例同步執行就會出現上述的錯誤。 axios的then function console.dir this this gt undefined 解決 可以用bind綁定thi ...

2017-05-19 11:02 0 1217 推薦指數:

查看詳情

Uncaught (in promise) TypeError: this.setState is not a function

造成這個的原因多數是因為,  this  的指向錯誤,尤其是在我們  自定義函數  的時候報錯 解決辦法: 將自定義函數改成箭頭函數 如,將這種寫法 換成箭頭函數,就變成 這樣就行了。 ...

Thu May 28 00:59:00 CST 2020 0 1847
 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM