原文鏈接:https://dsx2016.com/?p=1106
公衆號:大師兄2016
錯誤日誌
控制檯報錯Cannot read property ‘_withTask’ of undefined
錯誤原因
遇到這種問題,多半是在template
中使用了某個在methods
未定義的方法
舉個栗子
在div
中設置了點擊事件響應toggleShow
方法
<div @click="toggleShow">test</div>
在method
中卻沒有定義
methods:{
}
問題本身
由於複製了其他地方的代碼,遺漏了對應的方法,導致報錯
錯誤提示是vue
提示,不是很明顯,雖然網上找到了答案,但是排查仍然耗費了一段時間
下次如果再遇到此類錯誤,優先檢查對應的方法