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.
標簽沒有結束標簽
當看到這個報錯,不要慌,你只是缺少了結束標簽,把它補充上就好了
示例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' 被定義但沒有被調用
示例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
總結
到此這篇關于Vue常見報錯整理的文章就介紹到這了,更多相關Vue常見報錯內容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關文章希望大家以后多多支持腳本之家!
相關文章
Vue?3?表格時間監(jiān)控與動態(tài)后端請求觸發(fā)詳解?附Demo展示
在Vue3中,使用el-table組件渲染表格數(shù)據(jù),通過el-table-column指定內容,時間點需前端校準,用getTime()比較,到達時觸發(fā)操作,異步API請求可用async/await處理,setInterval實現(xiàn)定時監(jiān)控,配合條件判斷防止重復請求2024-09-09
Vue 2源碼解析HTMLParserOptions.start函數(shù)方法
這篇文章主要為大家介紹了Vue 2源碼解析HTMLParserOptions.start函數(shù)方法,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪2022-08-08
vue-cli或vue項目利用HBuilder打包成移動端app操作
這篇文章主要介紹了vue-cli或vue項目利用HBuilder打包成移動端app操作,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2020-07-07

