前言
在Vue2项目开发过程中,我们经常会遇到eslint的报错,特别是关于组件命名的规范性问题。其中一种常见的错误是出现类似于 “Component name “xxxxx“ should always be multi-word” 的提示,意思是组件名应该是由多个单词组成。今天我们就来探讨一下这个问题,并总结出四种解决方法。
如下解决方案已成功解决报错问题,代码以及注释已标清,直接按照修改即可。
报错代码
vue-cli全新创建项目,并建立组件时提示报错,报错如下:
vscode标红提示:
Component name "index" should always be multi-word.eslintvue/multi-word-component-names
npm run serve / yarn serve报错:
ERROR Failed to compile with 1 error
C:\Users\wally\Desktop\vscode\vue\seal\seal_web\src\views\home\index.vue
1:1 error Component name "index" should always be multi-word vue/multi-word-component-names✖ 1 problem (1 error, 0 warnings)
You may use specia