antd4.0 踩坑记录


Table组件的dataSource

表现:报错,warning,缺少key。

解决方案:数据处理增加key值即可

例如在model的reducer里

    codeList: list.map(v => {
          v.key = v.id
          return v
        }),

 ESLint的报错 error Identifier '' is not in camel case @typescript-eslint/camelcase

现象描述:后端传递给前端的字符不一定是标准的驼峰,有时是下划线,所以有时候会过不了lint检测

解决方案:添加自己的规则

//  .eslintrc.js
module.exports = {
  extends: [require.resolve('@umijs/fabric/dist/eslint')],
  globals: {
    ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION: true,
    page: true,
    REACT_APP_ENV: true,
  },
  rules: {
    '@typescript-eslint/camelcase': 'off',
  },
};

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM