vue项目报错:Component name “xxx“ should always be multi-word vue/multi-word-component-names
报错的意思是组件名应该始终是多单词,不应该以单个单词命名组件
解决方法1:
例如当前的登陆组件名是Login.vue修改成LoginName.vue,组件名需要以驼峰式命名至少两个单词,不一定都得是LoginName.vue可以是NameLogin.vue也可以是LoginNiu.vue总之就是以驼峰式命名至少两个单词,这有些类似不同项目前缀命名了**
解决方法2:
修改配置,禁用eslint的多单词命名规则。
在vue.config.js配置中添加规则lintOnSave:false
const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
transpileDependencies: true
})
修改后:
const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
transpileDependencies: true,
lintOnSave:false
})