报错:error Component name “xxx“ should always be multi-word vue/multi-word-component-names

在启动vue项目时报错如下:

报错原因:文件命名不规范

命名可遵循如下规范:

单文件组件的文件名应该要么始终是单词大写开头(VueDemo),要么始终是横线连接(vue-demo)

解决方法:

  • 第一种:把文件名按规范填写
  • 第二种:在vue.config.js中添加如下代码
const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
  transpileDependencies: true,
  lintOnSave:false
})

猜你喜欢

转载自blog.csdn.net/m0_70619994/article/details/127931589