报错:

Component name "Password" should always be multi-word  vue/multi-word-component-names

原因:

给组件命名时没有使用驼峰命名法或横线拼接单词,实际上是语法检测的问题,语法检查时将不规范的代码当成了错误。

语法检查时要求组件名不能是单个单词,因此单个单词如 Password会报错。

解决方法:

方法一:更改组件名,使其符合命名规范如:驼峰命名法 或  横线拼接单词。

方法二:关闭语法检测(通常)。

在 vue.config.js 文件中加上一行 lintOnSave: false

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

保存后重新编译就不会报错了

解决问题参考了文章:Vue脚手架报错: Component name "xxx" should always be multi-word vue/multi-word-component-names - 哪家磨刀 - 博客园 (cnblogs.com)icon-default.png?t=M85Bhttps://www.cnblogs.com/hcscar/p/16010759.html 

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐