error Component name “Home“ should always be multi-word vue/multi-word-component

604 阅读1分钟

在Vue中,新加一个组件,运行的时候报错:

# error Component name “Home“ should always be multi-word vue/multi-word-component-names

原因:

在定义组件或者变量没有被调用的时候,在 eslint 的严格模式下,这种规则是不合法的。

解决方法:

1、修改组件名为多个单词,使用驼峰命名方式或者用“-”连接单词

2、关闭严格模式

1)、在package.json文件中,添加 "no-unused-components": "off"

image.png

2)、在vue.config.js文件中加入 lintOnSave: false

image.png