【jeecg-boot+Antd】Warning: table should have a unique `key` prop, or set `rowKey`

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

前端vue中使用antd的table组件的时候控制台警示:Each record in dataSource of table should have a unique key prop, or set rowKey of Table to an unique primary key,
警告解释:表中的每个记录应该有唯一的“key”支持,或者将“rowKey”设置为唯一的主键。但是,返回的数据里没有名为key的键值,table也没有设置rowKey。
因此,此警告有2种解决方案。

1、在table组件上设置表是以什么作为key来区别每一行数据的
示例:以id为key,使用row-key属性 (添加row-key=“id”)
<a-table row-key=“id”
… >


在这里插入图片描述
2、对数据做处理,加入key的键值对。

{
id:1,
pname: ‘XXXXXX’,
pcode: ‘XXXX’,
cusitemname: ‘XXXXX’,
opttype: ‘XXXXX’,
optionval: ‘XXXXX’,
matid: ‘XXX’,
addprice:‘XXXX’,
optmemo:‘XXXXX’
},
在这里插入图片描述