一.不要在子组件中修改父组件传过来的props数据,否则会报如下错误.
vue.runtime.esm.js?c320:619 [Vue warn]: Avoid mutating a prop directly since the value will be overwritten whenever the parent component re-renders. Instead, use a data or computed property based on the prop's value
二.Module not found: Error: Can't resolve 导入文件不成功找不到文件,排查文件名有没有错误,比如vue前面忘了加".",或者是main.js中导入的文件路径有误
三. Component name "Ranking" should always be multi-word vue/multi-word-component-names
问题原因:
给组件命名时没有使用驼峰命名法或横线拼接单词,编译的时候一直报错,实际上是语法检测的问题,语法检查时将不规范的代码当成了错误。不同人或公司的语法标准不同,所以会常报错。
注意:语法检查时要求组件名不能是单个单词,因此单个单词如 School 也会报错。
解决方法:
方法一:更改组件名,使其符合命名规范如:驼峰命名法(CamelCase命名) 或 横线拼接单词(kebab-case命名) 。
方法二:关闭语法检测(通常)。
在 vue.config.js 文件中加上一行 lintOnSave: false