记录vue报错之组件命名报错“Component name “XXX“ should always be multi-word”的解决方法
第一种解决办法:
修改组件名称为大驼峰,不要用系统中命令常见的名称
第二种解决办法:
在根目录下,打开【.eslintrc.js】文件,如果没有,就新建,代码如下:
module.exports = { root: true, env: { node: true }, 'extends': [ 'plugin:vue/essential', 'eslint:recommended' ], parserOptions: { parser: '@babel/eslint-parser' }, rules: { 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off', 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off', //在rules中添加自定义规则 //关闭组件命名规则 "vue/multi-word-component-names":"off", }, overrides: [ { files: [ '**/__tests__/*.{j,t}s?(x)', '**/tests/unit/**/*.spec.{j,t}s?(x)' ], env: { jest: true } } ] }
修改完毕如果还是不行的话,可以尝试退出vscode,重进项目