Vue踩過的坑

vue文件縮進問題,嚴格縮進,如果需要四個字符的縮進請修改爲,當然造成這個的結果是,創建文件的時候

Use EsLint to lint your code?這句話就是告訴你是不是要給你管理代碼縮進,選擇No就完事了,啥事沒有

下面是.eslintrc.js的代碼,如果你選擇了Yes的話就修改下面這段代碼吧最主要的是

overrides: [
    {
      'files': ['*.vue'],
      'rules': {

//關閉縮進檢測
        'indent': 'off'
      }
    }

// https://eslint.org/docs/user-guide/configuring

module.exports = {
  root: true,
  parserOptions: {
    parser: 'babel-eslint'
  },
  env: {
    browser: true,
  },
  extends: [
    // https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention
    // consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules.
    'plugin:vue/essential',
    // https://github.com/standard/standard/blob/master/docs/RULES-en.md
    'standard'
  ],
  // required to lint *.vue files
  plugins: [
    'vue'
  ],
  // add your custom rules here
  rules: {
    // allow async-await
    'generator-star-spacing': 'off',
    //這就是設置縮進的,2個空格,單倍縮進,請看overriders,indent設置off,就代表不檢查縮進
    //所以下面這句話可以註釋
   // 'vue/script-indent':['error',2,{'baseIndent':1}],
    // allow debugger during development
    'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
  },
  overrides: [
    {
      'files': ['*.vue'],
      'rules': {
        'indent': 'off'
      }
    }
  ]
}

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章