关于antd 表格插件Table问题 antd

用Table表格插件,发现控制台有Warning提示,怎么把这个提示解决呢,百度了下,说加上rowKey="id",发现加上还是有警告提示

Warning: Each record in table should have a unique `key` prop,or set `rowKey` to an unique primary key.
阅读 3.9k
2 个回答

设置rowKey={(record, index) => index}

    <Table pagination={pagination} rowKey={(record, index) => index} columns={columns} dataSource={table.list} size="middle" bordered/>

是不是你数据的id字段中有重复的,或者根本id这个字段

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题