在Vue3.0中,有这些常见错误,快来看看这些错误你遇到过吗?遇到又如何解决呢?
01 没有捕捉到的类型错误 Uncaught TypeError
错误出现的文件 C:\myel\src\views\AdminView.vue
错误原因:e.preventDefault 不是一个函数
解决办法:将click后面的.prevent去掉即可
02 编译问题 Compiled with problems:
1)
错误出现的文件 C:\myel\src\views\HomeView.vue
3:1 error Mixed spaces and tabs no-mixed-spaces-and-tabs 第3行的第一个字符
4:1 error Mixed spaces and tabs no-mixed-spaces-and-tabs 第4函的第一个字符
错误原因:Mixed spaces and tabs ---混合的空格与tab
错误规则: no-mixed-spaces-and-tabs 不准混空格与tab
2)
错误出现的文件 C:\youmi\src\views\AboutView.vue
错误原因:check被定义了没有备调用
03 文件名/路径发生错误
错误地址:ERROR in ./src/router/index.ts 10:19-57 错误发生的文件 ./src/router/index.ts 第10行第19个字符到57字符
错误原因Module not found: Error: Can't resolve '../views/admin/AdminVeiw.vue' in 'C:\myel\src\router' 模块找不到,不能resolve(兑现,发现,解决)../views/admin/AdminVeiw.vue 在C:\myel\src\router
总结:文件../views/admin/AdminVeiw.vue(文件名/路径发生错误)
04 标签使用错误
错误地址:ERROR in ./src/views/HomeView.vue 错误发生在HomeView.vue
错误原因:VueCompilerError: Element is missing end tag. 标签没有结束标签
2 | <div class="login">
| ^
第二行的div
05 未定义错误
出错的文件地址在 C:\youmi\src\views\AboutView.vue
16:17 error 'reactive' is not defined no-undef---第16行17字符错误 reactive 没有定义
06 vuex错误
错误地址:App.vue 第30错误
错误原因:[vuex] unknown mutation type: changeA ---vuex 找不到一个叫changeA的mutations
07 vue编译错误
错误原因:VueCompilerError: Attribute name cannot contain U+0022 ("), U+0027 ('), and U+003C (<) --- vue编译错误:属性name 不能不包含 “ ‘ <
错误地址: at C:\youmi\src\views\AboutView.vue:8:2 第8行