在使用ant的过程中,我相信有很多人都会遇到这个错误,
解决方式需要根据不再的场景来,遵循的只有一个原则,设置key值,
在table中:需要设置rowKey,如果dataSource中没有id的话,需要设置rowKey的值指向唯一.
在option中也 需要设置key值的,比如:有一段数据
const menuItem = [ { value:'0',text:'项目出勤' },{ value:'1',text:'春节放假' },{ value:'2',text:'春节待命' },{ value:'3',text:'带薪假(婚/丧/探/亲)' },{ value:'4',text:'带薪病假' },{ value:'5',text:'事假' },{ value:'6',text:'旷工' },];
在做循环的时候,需要设置key值,不然会报错,可以这样做,
<Select style={{ width: 80 }} onChange={this.fatherSelectChange.bind(this)}> {menuItem.map((item,index) =>{ return( <Option key={index} value={item.value}>{item.text}</Option> ) })} </Select>
欢迎各界大神前来指导,有问题也可以在下方留言交流.
原文地址:https://www.jb51.cc/react/302921.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。