Warning: Each record in table should have a unique `key` prop,or set `rowKey` to an unique primary

2020-05-15 22:37:37

解决办法:

(recordindex) => index

这样也可以

Warning: Each record in dataSource of table should have a unique `key` prop, or set `rowKey` of Table to an unique primary key,


使用table组件的时候控制台警示:Each record in dataSource of table should have a unique key prop, or set rowKey of Table to an unique primary key,

返回的数据里没有名为key的键值,所以需要在组件上设置这个表是以什么作为key来区别每一行数据的。

解决:

使用row-key属性 (添加row-key="id")

<a-table  row-key="id"   ...  >

      ...

</a-table>



  • 2019-10-11 13:48:00

    关于Integer比较相等的问题

    原来两个Integer类型的数字不能用==来判断,要用equal 不过Integer类型的可以与1,2这样的纯数字来判断

  • 2019-10-14 21:18:57

    Comparable 的 使用

    要做这个呢,我们也是用到了Arrays.sort 这个排序的方法!但不同的是,我们之前用的是int数组,现在我们用的是这个UserBean数组。如果你想对这个UserBean数组进行排序,你要多做一件事,就是让这个 UserBean类去 实现Comparable 的接口,并重写 里面  comparaTo 的方法。注意,这个接口是可以提供泛型的 ———————————————— 版权声明:本文为CSDN博主「sdn_bt496」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明