vue报错 mixed spaces and tabs

2,770 阅读1分钟

mixed spaces and tabs no-mixed-spaces-and-tabs

报错原因:项目使用了eslint 规范代码,而你的代码违反了规范,含有不规范的空格

解决方案一:格式化代码

通过编辑器格式化代码,统一缩进方式

解决方案二:关闭eslint对空格和tab的校验

在package.json中对 eslintConfig进行详细配置

 "eslintConfig": {
    "root": true,
    "env": {
      "node": true
    },
    "extends": [
      "plugin:vue/essential",
      "eslint:recommended"
    ],
    "parserOptions": {
      "parser": "babel-eslint"
    },
    "rules": {
      "no-console": "off",
      "no-debugger": "off",
      "no-mixed-spaces-and-tabs": "off"//新增这一行
    }
 
  }