Vue常見報錯整理大全(從此報錯不害怕)
整理一下Vue中一些常見的報錯和bug,以及解決辦法
示例1(文件名/路徑發(fā)生錯誤)
Compiled with problems:———編譯問題:
ERROR in ./src/router/index.ts 10:19-57
錯誤發(fā)生在 ./src/router/index.ts 第10行第19個字符到57字符
Module not found: Error: Can't resolve '../views/admin/AdminVeiw.vue' in 'C:\myel\src\router'
模塊找不的 不能resolve(兌現(xiàn),發(fā)現(xiàn),解決)../views/admin/AdminVeiw.vue
在C:\myel\src\router
示例2(標簽不完整)
ERROR in ./src/views/HomeView.vue
錯誤發(fā)生在HomeView.vue
VueCompilerError: Element is missing end tag.
標簽沒有結(jié)束標簽
當看到這個報錯,不要慌,你只是缺少了結(jié)束標簽,把它補充上就好了
示例3(error 'xxx' is not defind)
C:\youmi\src\views\AboutView.vue
出錯的文件路徑
16:17 error 'reactive' is not defined no-undef
第16行17字符錯誤 reactive 沒有定義
示例4(unknown mutation type: changeA)
[vuex] unknown mutation type: changeA
vuex 找不到一個叫changeA的mutations
示例5(Attribute name cannot contain U+0022 ("), U+0027 ('), and U+003C (<).)
ERROR in ./src/views/AboutView.vue
在AboutView發(fā)生錯誤
VueCompilerError: Attribute name cannot contain U+0022 ("), U+0027 ('), and U+003C (<).
編譯錯誤:屬性name 不能不包含 (“),(‘)(<)
示例6(TypeError:Assignment to constant variable.)
const 不能重復賦值
示例7(error 'check' is assigned a value but never used )
error 'check' is assigned a value but never used no-unused-vars
'check' 被定義但沒有被調(diào)用
示例8(no-mixed-spaces-tabs)
Compiled with problems:
編譯問題
C:\myel\src\views\HomeView.vue
錯誤出現(xiàn)文件
3:1 error Mixed spaces and tabs no-mixed-spaces-and-tabs
4:1 error Mixed spaces and tabs no-mixed-spaces-and-tabs
第3行的第一個字符
第4函的第一個字符
Mixed spaces and tabs
錯誤原因:混合的空格與tab
no-mixed-spaces-and-tabs
錯誤規(guī)則: no-mixed-spaces-and-tabs 不準混空格與tab
總結(jié)
到此這篇關(guān)于Vue常見報錯整理的文章就介紹到這了,更多相關(guān)Vue常見報錯內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
利用Vue模擬實現(xiàn)element-ui的分頁器效果
這篇文章主要為大家詳細介紹了如何利用Vue模擬實現(xiàn)element-ui的分頁器效果,文中的示例代碼講解詳細,感興趣的小伙伴可以動手嘗試一下2022-11-11vue+node+socket io實現(xiàn)多人互動并發(fā)布上線全流程
這篇文章主要介紹了vue+node+socket io實現(xiàn)多人互動并發(fā)布上線全流程,本文給大家提到了socket.io相關(guān)用法概覽及開發(fā)流程,需要的朋友可以參考下2021-09-09