`1. Warning: [antd: Form.Item] `name` is only used for validate React element.
If you are using Form.Item as layout display, please remove `name`
- 答:注册FormItem中的name属性,name用于验证表单,但是你显示的内容不是表单元素
2. `date.clone is not a function`
- 答:设置日期默认值失败,格式(数据类型)不符合。可以在FormItem中设置 initialValue = {moment(new Date('2012-12-12'))},注意:moment要安装 yarn add monent, 引入:import moment from 'moment'
`3. index.js:1 Warning: Each child in a list should have a unique "key" prop.Check the render method of `Body`.`
- 答:元素没有设置key或key不唯一,设置key即可。一般循环的元素和表格等都需要设置key,报错信息第一或第三行左右就是没有key的那个元素
4. `Warning: Please avoid setting option to disabled in tags mode since user can always type text as tag.`
- 答:下拉选项全设置成了禁选
5. 'xxx' is not defined no-undef
- 答:xxx没有定义或者没有引入
6. `Failed to load resource: the server responded with a status of 504 (Gateway Timeout)`
- 答:请求接口失败
7.` Uncaught TypeError: Cannot read property 'id' of null`
- 答:对象为null,比如:let obj = null; obj.id,一般可以进行三目运算符赋默认值,obj = obj ?? {},或者obj?.id
8.` Warning: Can not find FormContext. Please make sure you wrap Field under Form.`
- 答:formItem下面包裹的字段为空。
9. `Expected an assignment or function call and instead saw an expression no-unused-expressions`
-
答:元素赋值或者函数调用时,出现一个表达式,理解为类型不匹配,比如:let num = 1 === 1 ? console.log(true) : false。react中常见为函数返回了两个标签,可以使用<></>空标签将两个标签包裹。
-