解决报错: error Component name "School" should always be multi-word vue/multi-word-component-names

发布时间 2023-06-14 21:47:18作者: 哩个啷个波

运行时遇到这个问题

自己在给组件命名时没有使用大驼峰或者'-'拼接单词,所以编译的时候报错,实际上是语法检测的问题

解决方案一:

最朴素的方式,直接改名

解决方案二:

关闭校验

在根目录下找到vue.config.js文件【没有就新建一个】,添加下面的代码

const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
  transpileDependencies: true,
  lintOnSave: false
})

上两种方法都可以解决问题,亲测有效