JavaShuo
欄目
標籤
微信小程序setData報錯TypeError: Cannot read property ‘setData‘ of undefined的解決方案
時間 2020-12-29
原文
原文鏈接
今天寫案例的時候,在onLoad函數中用this.setData重置了一個數值,然後就一直報錯,結果如下: 問題的原因: 無法找到setData這個定義,因爲setData中是onLoad函數中的方法中的子節點, 無法使用this 解決方案 這個時候需要在方法的開始部分定義var that = this,然後用that.setData來重置,這樣就解決了這個問題了。 如下圖:
>>阅读原文<<
相關文章
1.
微信小程序報Cannot read property 'setData' of undefined的錯誤
2.
微信小程序Cannot read property 'setData' of null錯誤
3.
react報錯 TypeError: Cannot read property 'setState' of undefined
4.
× react報錯:TypeError: Cannot read property ‘render‘ of undefined
5.
vue報錯:"TypeError: Cannot read property 'forEach' of undefined"
6.
Vue.js報錯—TypeError: Cannot read property 'Name' of undefined
7.
瀏覽器報Uncaught TypeError: Cannot read property 'trigger' of undefined解決方案
8.
微信小程序報錯:Cannot read property ‘forceUpdate‘ of undefined
9.
微信小程序報錯:Cannot read property ‘forceUpdate’ of undefined
10.
(已解決)TypeError: Cannot read property '_t' of undefined
更多相關文章...
•
SVN 解決衝突
-
SVN 教程
•
ASP Read 方法
-
ASP 教程
•
常用的分佈式事務解決方案
•
PHP Ajax 跨域問題最佳解決方案
相關標籤/搜索
setdata
解決方案
小程序報錯
微信_小程序
微信小程序
解決方案 二
解決方案 七
typeerror
property
undefined
瀏覽器信息
Spring教程
NoSQL教程
教程
微服務
0
分享到微博
分享到微信
分享到QQ
每日一句
每一个你不满意的现在,都有一个你没有努力的曾经。
最新文章
1.
Android Studio3.4中出現某個項目全部亂碼的情況之解決方式
2.
Packet Capture
3.
Android 開發之 仿騰訊視頻全部頻道 RecyclerView 拖拽 + 固定首個
4.
rg.exe佔用cpu導致卡頓解決辦法
5.
X64內核之IA32e模式
6.
DIY(也即Build Your Own) vSAN時,選擇SSD需要注意的事項
7.
選擇深圳網絡推廣外包要注意哪些問題
8.
店鋪運營做好選款、測款的工作需要注意哪些東西?
9.
企業找SEO外包公司需要注意哪幾點
10.
Fluid Mask 摳圖 換背景教程
本站公眾號
歡迎關注本站公眾號,獲取更多信息
相關文章
1.
微信小程序報Cannot read property 'setData' of undefined的錯誤
2.
微信小程序Cannot read property 'setData' of null錯誤
3.
react報錯 TypeError: Cannot read property 'setState' of undefined
4.
× react報錯:TypeError: Cannot read property ‘render‘ of undefined
5.
vue報錯:"TypeError: Cannot read property 'forEach' of undefined"
6.
Vue.js報錯—TypeError: Cannot read property 'Name' of undefined
7.
瀏覽器報Uncaught TypeError: Cannot read property 'trigger' of undefined解決方案
8.
微信小程序報錯:Cannot read property ‘forceUpdate‘ of undefined
9.
微信小程序報錯:Cannot read property ‘forceUpdate’ of undefined
10.
(已解決)TypeError: Cannot read property '_t' of undefined
>>更多相關文章<<