Vue的Eslint中常见的报错解决方法
语法错误
"TypeError: Cannot read property 'resetFields' of undefined"
关键字前面的值变成了undefined
property or method "isCollapse" is not defined on the instance but referenced during render. Property or method "a" is not defined on the instance but referenced during render.
关键字在页面中使用了,但是没有在data或methods中定义, 使用的和定义的名字不一致
Module not found: Error: Can't resolve './views/User/index.vue'
当前的路径错误,仔细核对路径
<el-card> - did you register the component correctly? For recursive components, make sure to provide the "name" option.
没有注册(导入该组件),或者导入注册组件的名字和使用的名字不一致
在项目打包之后,项目运行不起来,路径出了问题,通过下面方式解决
vue.config.js module.export = { publicPath: './' }
eslint常见错误
Too many blank lines at the end of file
结尾处换行超过1行
Newline required at end of file but not found
结尾处没有新的换行
Missing space before value for key 'render'
丢失了空格在key的冒号后面
Strings must use singlequote
必须是单引号
Trailing spaces not allowed
当前行末尾处有多余的空格
Expected indentation of 8 spaces but found 10
当前行希望是前面有8个空格缩进但是有10个空格缩进
'Login' is defined but never used
定义了Login, 但是没有使用到
F:\课程\课程项目\vue\admin_13\src\router\index.js 28:20 error 'Welcome' is not defined no-undef
在路由的js中出现这个错误,那么就是使用了这个组件,没有定义导入进来,或者就是导入组件接收的名字和使用的时候不一致
More than 1 blank line not allowed
不允许换行超过1次, 只能有一行换行
Unexpected trailing comma
结尾处多了一个逗号
Extra semicolon
结尾处多了分号
Missing space before function parentheses
方法简写的()前面没有空格
Missing space before opening brace
时间如白驹过隙,忽然而已,且行且珍惜......
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· Docker 太简单,K8s 太复杂?w7panel 让容器管理更轻松!