在用vuex的時候報一個很‘坑嗲’的錯誤:Cannot read property 'dispatch' of undefined
在用vuex的時候報一個很‘坑爹’的錯誤,如下圖:
我找了很久才找到原因,其他程式碼都沒問題,就是報了上面那個錯誤,原來是我在main.js import store from './store.js'的問題
如圖:
這樣就會報錯,
後來我改成小寫之後:
錯誤就消失了,我也不知道為什麼。
通常我引入一個元件,我都是首字母大小寫,誰知道引入store卻不行,真是很坑爹啊
相關推薦
在用vuex的時候報一個很‘坑嗲’的錯誤:Cannot read property 'dispatch' of undefined
在用vuex的時候報一個很‘坑爹’的錯誤,如下圖: 我找了很久才找到原因,其他程式碼都沒問題,就是報了上面那個錯誤,原來是我在main.js import store from './store.js'的問題 如圖: 這樣就會報錯, 後來我改成小寫之後:
vue 報錯:Cannot read property 'xxx' of undefined",但是頁面能渲染上資料
有時候會遇到給頁面繫結資料的時候,可以繫結成功,但vue warn:xxx屬性of undefined,,,如果本元件只是繫結簡單的資料倒是可以忽略,如果本元件還引入了其他元件或第三方元件,外掛,則就渲染不出來,就需要解決了, <template>
easyui列表查詢報錯:Cannot read property 'length' of undefined
1.問題描述 easyui中datagrid執行loadData方法出現如下異常:Cannot read property 'length' of undefined 2.一開始懷疑是js或者頁面的問題,然後從早上幹到下午,網上各種方法用盡了就是不行! 最後
element-ui報錯Cannot read property 'resetFields' of undefined
[Vue warn]: Error in event handler for "click": "TypeError: Cannot read property 'resetFields' of undefined" 這個錯誤是因為你的dom元素還沒有載入完,你就想使用
Element UI級聯選擇器報錯"TypeError: Cannot read property 'getElementsByClassName' of undefined"
當點選的時候第一層出現的報錯(導致二級出不來) 原因: value 和 label的值未正確指定, 此處value並不存在options資料中 解決: 修改為:
datatables表格外掛(1) Uncaught TypeError: Cannot read property 'length' of undefined錯誤分析
前端小白,第一次接觸Datatables表格外掛,經常會遇到Uncaught TypeError: Cannot read property ‘length’ of undefined這麼個報錯 我也遇到了好幾次,每次都沒記住,幾天狠下心來寫一篇推文,分享給大家
NodeJs錯誤:TypeError: Cannot read property 'path' of undefined
情景重現: 錯誤程式碼: function upload(response, request){ console.log("Request handler 'upload' was called."); var form = new formidable.Incom
修改樣式表時在某些瀏覽器(如360)下遇到Cannot read property 'style' of undefined錯誤的解決方案
自己寫的2048遊戲,在本地除錯一切正常後,上傳至伺服器,Chrome效果正常,但發現JavaScript在360瀏覽器中出錯,提示Uncaught TypeError: Cannot read property 'style' of undefined 錯誤定位如下圖
TS/JS錯誤:TypeError: Cannot read property 'prototype' of undefined
總結一下解決這個錯誤的引起和過程。 錯誤資訊:TypeError: Cannot read property ‘prototype’ of undefined 開發語言:TypeScript 編譯後語言:JavaScript 開發工具:LayaAir
mpvue開發微信小程式,分享按鈕報錯:`Cannot read property 'apply' of null`
用mpvue開發微信小程式,分享按鈕報錯:Cannot read property 'apply' of null thirdScriptError Cannot read property 'appl
記錄一個bootstrap因js載入順序導致的問題(tstrap-table-mobile.min.js:7 Uncaught TypeError: Cannot read property 'defaults' of undefined)
問題描述: 網上找了會沒看到答案,然後看了下原始碼,發現也沒有問題,想到js載入的順序,改了下,發現問題沒了。 正確的順序: 我之前把 <script src="/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></sc
使用form的方法(例如:reset,clear等)報錯Uncaught TypeError: Cannot read property 'tip' of undefined(…)的原因
在瀏覽器中debug前端程式碼時,第一次按一個按鍵,沒有問題,第二次開始再按這個按鍵的時候,出現了錯誤Uncaught TypeError: Cannot read property 'tip' of undefined(…),雖然不影響功能,但是出現紅色的錯誤總是感覺
easyui中datagrid顯示資料的時候報Cannot read property 'length' of undefined
最近在搭一個框架,頁面開發完後,發現沒有資料顯示,經查詢是因為js報錯了,錯誤資訊如下: Cannot read property 'length' of undefined 進一步檢視原因,是因為rows.length報的錯,說明沒有rows這個變數,但是檢
解決vue2.0路由 TypeError: Cannot read property 'matched' of undefined 的錯誤問題
剛開始使用vue-router2.0,雖然也用了vux,用起來卻發現一個問題……具體如下: 正常情況下使用腳手架跑完之後,然後修改源專案,首先在main.js入口裡把該import進去的vuex,vue-router,vue-resource等等都啟動好了,接著就是在對應的資
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之間的相容問題。解決方法如下:
JS —— Uncaught TypeError: Cannot read property 'slice' of undefined 錯誤
JS Array 物件的slice 方法: arrayObject.slice(start,end) 引數說明: start: 必需。規定從何處開始選取(為索引,從0開始)。如果是負數,那麼它規定
Webpack+react-router 報 Cannot read property 'toUpperCase' of undefined
用的是0.13的版本,呼叫的API是1.0的API。 可以看一下官網的升級指導。 // v0.13.x Router.run(routes, (Handler) => { React.render(<Handler/>, el); }) // v1.
支付寶小程式setData報TypeError: Cannot read property 'setData' of undefined問題
我在onLoad函式中用this.setData重置了一個數值,然後就一直報錯,結果如下 問題原因: 無法找到setData這個定義,因為setData中是onLoad函式中的方法中的子節點, 無法使用this 解決方法 這個時候需要在方法的開始部分定義var
Vue2.0 之 vue Cannot read property '__ob__' of undefined 異常(back報錯)
Vue2.0 之 back鍵報錯 (異常:vue Cannot read property ‘ob’ of undefined) 這個原因是因為我在本頁面迴圈了元件的原因,例如: