VUE 错误 : Expected indentation of 4 spaces but found 6 和 Missing space before function parentheses

出现这个问题的原因是代码的缩进没有对其,例如

VUE 错误 : Expected indentation of 4 spaces but found 6 和 Missing space before function parentheses

上图代码看上去没有问题,但是会报下面的错误

VUE 错误 : Expected indentation of 4 spaces but found 6 和 Missing space before function parentheses

如果改成这样,把前面的缩进去掉,然后括号中间添加空格,就不会报错。

VUE 错误 : Expected indentation of 4 spaces but found 6 和 Missing space before function parentheses

但是这样很恶心有没有?使用代码整理功能一个代码整理,所有的代码都异常了,很恶心有没有?

解决办法是,在.eslintrc.js 的rules中添加如下代码,关闭缩进检查和规则校检。

VUE 错误 : Expected indentation of 4 spaces but found 6 和 Missing space before function parentheses