Просмотр исходного кода

【更新】修改代码规范校验、列表组件返回数据中rows字段为null报错

俞宝山 4 лет назад
Родитель
Сommit
7e351d2b6d
2 измененных файлов с 14 добавлено и 32 удалено
  1. 10 32
      _web/.eslintrc.js
  2. 4 0
      _web/src/components/Table/index.js

+ 10 - 32
_web/.eslintrc.js

@ -1,37 +1,15 @@
module.exports = {
  root: true,
  env: {
    node: true
  "root": true,
  "env": {
    "node": true
  },
  'extends': [
    'plugin:vue/strongly-recommended'
  "extends": [
    "plugin:vue/essential",
  ],
  rules: {
    'import/newline-after-import': 'off',
    'no-param-reassign': 'off',
    'space-before-function-paren': 'off',
    'object-curly-spacing': 'off',
    'block-spacing': 'off',
    'dot-notation': 'off',
    'arrow-parens': 'off',
    'space-before-blocks': 'off',
    'no-confusing-arrow': 'off',
    'arrow-body-style': 'off',
    "vue/no-unused-components": "off",
    semi: 'off'
  "rules": {
    "no-console": 0
  },
  parserOptions: {
    parser: 'babel-eslint'
  },
  overrides: [
    {
      files: [
        '**/__tests__/*.{j,t}s?(x)',
        '**/tests/unit/**/*.spec.{j,t}s?(x)'
      ],
      env: {
        jest: true
      }
    }
  ]
  "parserOptions": {
    "parser": "babel-eslint"
  }
}

+ 4 - 0
_web/src/components/Table/index.js

@ -165,6 +165,10 @@ export default {
            pageSize: (pagination && pagination.pageSize) ||
              this.localPagination.pageSize
          }) || false
          //防止后端数据此项出现null报错
          if(r.rows==null){
            r.rows=[]
          }
          // 为防止删除数据后导致页面当前页面数据长度为 0 ,自动翻页到上一页
          if (r.rows.length === 0 && this.showPagination && this.localPagination.current > 1) {
            this.localPagination.current--