支付寶小程式setData報TypeError: Cannot read property 'setData' of undefined問題
我在onLoad函式中用this.setData重置了一個數值,然後就一直報錯,結果如下
問題原因:
無法找到setData這個定義,因為setData中是onLoad函式中的方法中的子節點,
無法使用this
解決方法
這個時候需要在方法的開始部分定義var that = this,然後用that.setData來重置,這樣就解決了這個問題了
相關推薦
支付寶小程式setData報TypeError: Cannot read property 'setData' of undefined問題
我在onLoad函式中用this.setData重置了一個數值,然後就一直報錯,結果如下 問題原因: 無法找到setData這個定義,因為setData中是onLoad函式中的方法中的子節點, 無法使用this 解決方法 這個時候需要在方法的開始部分定義var
使用 PropTypes 進行型別檢 || 控制檯報:TypeError: Cannot read property 'string' of undefined)
import PropTypes from 'prop-types'; MyComponent.propTypes = { // 你可以宣告一個 prop 是一個特定的 JS 原始型別。 // 預設情況下,這些都是可選的。 optionalArray: PropTypes.array, o
Element UI級聯選擇器報錯"TypeError: Cannot read property 'getElementsByClassName' of undefined"
當點選的時候第一層出現的報錯(導致二級出不來) 原因: value 和 label的值未正確指定, 此處value並不存在options資料中 解決: 修改為:
使用form的方法(例如:reset,clear等)報錯Uncaught TypeError: Cannot read property 'tip' of undefined(…)的原因
在瀏覽器中debug前端程式碼時,第一次按一個按鍵,沒有問題,第二次開始再按這個按鍵的時候,出現了錯誤Uncaught TypeError: Cannot read property 'tip' of undefined(…),雖然不影響功能,但是出現紅色的錯誤總是感覺
ionic3_ion-slide報錯Uncaught TypeError: Cannot read property 'hasAttribute' of undefined
在使用ion-slide時報錯Uncaught TypeError: Cannot read property 'hasAttribute' of undefined,經檢查發現是由於陣列資料沒有值的原
vue 報錯解決:TypeError: Cannot read property '_t' of undefined"
前端報錯如下: [Vue warn]: Error in render: “TypeError: Cannot read property ‘_t’ of undefined” 是在專案中用了多語言配置,vue 跟 i18n之間的相容問題。解決方法如下:
TypeError: Cannot read property ‘url‘ of undefined
React-router引言 使用React-router感覺還是有一定「曲線」的,首先要熟悉ES6且不說,對於JSX擴展語法及React-router有關路由表達稍有馬虎都不可以。當出現如題所示錯誤時,我在網絡上搜索,竟然沒有找到幾處可參考的。倒是有一個如下: https://teamtreehouse.c
Error in render: "TypeError: Cannot read property 'XXXXX' of undefined"
最近,小弟在使用vue開發介面時,出現一個有趣問題:功能正常使用,但F12卻報出一個XXX Undefined的錯誤。這個錯誤已經見了無數次,於是果斷去Ctrl+F搜尋XXX,仔細瀏覽一圈後發現xxx明明是定義了的。整體流程:介面渲染前先通過mounted載入
element-ui報錯Cannot read property 'resetFields' of undefined
[Vue warn]: Error in event handler for "click": "TypeError: Cannot read property 'resetFields' of undefined" 這個錯誤是因為你的dom元素還沒有載入完,你就想使用
Uncaught TypeError: Cannot read property 'addMethod' of undefined
目錄 出現以上錯誤有倆種情況: 1:js 引入順序 jquery.validate.js 引入的順序一定要在執行$.validator.addMethod()之前引入。 解決方案:保證 jquery.validate.js 優先引入。 2:‘$’ 衝突 當
關於Uncaught TypeError: Cannot read property 'toLowerCase' of undefined的問題
今天我在處理表單時根據觸發事件動態獲取input中的value值,我是直接在html程式碼中設定響應函式,函式中用jquery的$(this).val()獲取物件的value,結果控制檯報出如標題所示的錯誤,這我就納了悶了,怎麼會這樣,甚是糾結,上網一查排在前的
怎麼解決jQuery的Uncaught TypeError: Cannot read property 'init' of undefined這個問題
function initZtree(){ $.ajax({ url:"assetType_querytype.action", data:'', dataType:'json', type:'post'
datatables表格外掛(1) Uncaught TypeError: Cannot read property 'length' of undefined錯誤分析
前端小白,第一次接觸Datatables表格外掛,經常會遇到Uncaught TypeError: Cannot read property ‘length’ of undefined這麼個報錯 我也遇到了好幾次,每次都沒記住,幾天狠下心來寫一篇推文,分享給大家
vuejs路由使用的問題Error in render function: "TypeError: Cannot read property 'matched' of undefined"
從一次執行錯誤開始 html程式碼 <div id="app"> <router-link to="/home">首頁</router-link> <router-link to="/about"&g
easyui使用時出現這個Uncaught TypeError: Cannot read property 'combo' of undefined
easyui使用時出現這個Uncaught TypeError: Cannot read property 'nodeName' of undefined 最後檢查發現是必須給select一個id,光給name不行, 構建後,easyui改變了dom結構,元素的訪問
jquery.dataTables.min.js:62 Uncaught TypeError: Cannot read property 'style' of undefined原因
maven/java/web/bootstrapQQ群:566862629。希望更多人一起幫助我學習。 報錯: jquery.dataTables.min.js:62 Uncaught TypeError: Cannot read property 'style' of
NodeJs錯誤:TypeError: Cannot read property 'path' of undefined
情景重現: 錯誤程式碼: function upload(response, request){ console.log("Request handler 'upload' was called."); var form = new formidable.Incom
TS/JS錯誤:TypeError: Cannot read property 'prototype' of undefined
總結一下解決這個錯誤的引起和過程。 錯誤資訊:TypeError: Cannot read property ‘prototype’ of undefined 開發語言:TypeScript 編譯後語言:JavaScript 開發工具:LayaAir
vue.js中報錯: TypeError: Cannot read property 'indexOf' of undefined
[Vue warn]: Error when evaluating expression "name.indexOf('jack') >= 0": TypeError: Cannot read
TypeError: Cannot read property '$createElement' of undefined
使用vue-router,在main.js中import元件,初始化後報錯: Failed to resolve async component render: TypeError: Cannot r