[Bug]Vue 安装插件 vuetify 时终端报错:Component name "Home" should always be multi-word

170 阅读1分钟

我正在参加「掘金·启航计划」

一、问题描述

安装Vue的前端组件框架vuetify时,报错为:

image.png

二、问题分析

看起来是一个命名不标准的问题,应该和eslint配置项有关。

三、解决方案

修改项目中的两处地方:
添加:

// vue.config.js
module.exports = defineConfig({
  ...
  lintOnSave: false,  //保证编译不会报错
});

追加配置:

// .eslintrc.js
module.exports = {
  ...
  overrides: [
    {
      files: ["src/views/**/*.vue"],
      rules: {
        "vue/multi-word-component-names": 0,
      },
    },
  ],
};

修改结果:

image.png