解決vue2.0路由 TypeError: Cannot read property 'matched' of undefined 的錯誤問題
剛開始使用vue-router2.0,雖然也用了vux,用起來卻發現一個問題……具體如下:
正常情況下使用腳手架跑完之後,然後修改源專案,首先在main.js入口裡把該import進去的vuex,vue-router,vue-resource等等都啟動好了,接著就是在對應的資料夾和檔案裡面堆程式碼了。
APP.vue裡面只放了 <router-view></router-view>,然後再把一級路由都配好後.
雖然看起來很正常,儲存之後,node熱更新的面板也沒出什麼問題。
最後開啟localhost頁面後,卻發現頁面沒出來,就只有app.vue裡面的幾個樣式,但是控制檯裡卻丟出來了兩個錯誤。
主要看 TypeError: Cannot read property 'matched' of undefined 。
這個屬性,我其實也沒見過,但是頁面出不來,node也沒有報錯,就只有瀏覽器控制檯報錯的話,一般問題都出在“路由”的上面。
第一先排除 版本的問題,因為我用的是router2.0的,然後例項寫法都是按2.0寫的,後來去入口檔案main.js裡面找。
原來這個Router必須與外掛同名,本來我以為只是個別名而已,就隨便寫的。當把Router改成router的時候,頁面就出來了,報錯也沒了,不過,也要把上面對應的import Router 改過來,這個可能是外掛的問題。
我個人的公眾號(ZEROFC_DEV),關於web開發的,歡迎關注O(∩_∩)O~
相關推薦
解決vue2.0路由 TypeError: Cannot read property 'matched' of undefined 的錯誤問題
剛開始使用vue-router2.0,雖然也用了vux,用起來卻發現一個問題……具體如下: 正常情況下使用腳手架跑完之後,然後修改源專案,首先在main.js入口裡把該import進去的vuex,vue-router,vue-resource等等都啟動好了,接著就是在對應的資
怎麼解決jQuery的Uncaught TypeError: Cannot read property 'init' of undefined這個問題
function initZtree(){ $.ajax({ url:"assetType_querytype.action", data:'', dataType:'json', type:'post'
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
Vue2.0 之 vue Cannot read property '__ob__' of undefined 異常(back報錯)
Vue2.0 之 back鍵報錯 (異常:vue Cannot read property ‘ob’ of undefined) 這個原因是因為我在本頁面迴圈了元件的原因,例如:
datatables表格外掛(1) Uncaught TypeError: Cannot read property 'length' of undefined錯誤分析
前端小白,第一次接觸Datatables表格外掛,經常會遇到Uncaught TypeError: Cannot read property ‘length’ of undefined這麼個報錯 我也遇到了好幾次,每次都沒記住,幾天狠下心來寫一篇推文,分享給大家
[Vue warn]: Error in render: "TypeError: Cannot read property 'matched' of undefined"
菜鳥級的錯誤,,,, [Vue警告]:渲染錯誤:“TypeError:無法讀取屬性’匹配’的未定義” 沒有匯出例項,當然匹配不上啊!!!!!!! 改成下面就好了 export default new VueRouter({ routes: [
JS —— Uncaught TypeError: Cannot read property 'slice' of undefined 錯誤
JS Array 物件的slice 方法: arrayObject.slice(start,end) 引數說明: start: 必需。規定從何處開始選取(為索引,從0開始)。如果是負數,那麼它規定
TypeError: Cannot read property 'style' of null 錯誤解決
錯誤資訊如下: JSP程式碼如下: <c:if test ="${not empty excelErrors}"> <div id="excelErrorDiv" style="width:90%;margin-left:5%;">
vue 報錯解決:TypeError: Cannot read property '_t' of undefined"
前端報錯如下: [Vue warn]: Error in render: “TypeError: Cannot read property ‘_t’ of undefined” 是在專案中用了多語言配置,vue 跟 i18n之間的相容問題。解決方法如下:
Uncaught TypeError: Cannot read property 'msie' of undefined問題解決方案
我在替換UI的時候出現了不知道為什麼音訊播放不能使用了,通過除錯發現報了Uncaught TypeError: Cannot read property 'msie' of undefined這個錯誤。 原因是因為Jquery外掛版本9以後的browser屬性已經被移除
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載入
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,結果控制檯報出如標題所示的錯誤,這我就納了悶了,怎麼會這樣,甚是糾結,上網一查排在前的
Element UI級聯選擇器報錯"TypeError: Cannot read property 'getElementsByClassName' of undefined"
當點選的時候第一層出現的報錯(導致二級出不來) 原因: value 和 label的值未正確指定, 此處value並不存在options資料中 解決: 修改為:
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
修改樣式表時在某些瀏覽器(如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