Vue报错【已解决】【Component name “xxx“ should always be multi-word vue/multi-word-component-names】
Vue脚手架报错: Component name "xxx" should always be multi-word vue/multi-word-component-names - 哪家磨刀 - 博客园 (cnblogs.com)方法一:更改组件名,使其符合命名规范如:驼峰命名法 或横线拼接单词。给组件命名时没有使用驼峰命名法或横线拼接单词,实际上是。lintOnSave: false //关
·
报错:
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 //关闭语法检查
})
保存后重新编译就不会报错了
更多推荐
所有评论(0)