gpt4 book ai didi

javascript - antd table : why record. 键在我设置rowkey时返回undefined

转载 作者:行者123 更新时间:2023-11-29 20:35:16 27 4
gpt4 key购买 nike

enter image description here

enter image description here

表中有rowkey 等于列"mac",但我无法通过record.key 获取 key ,它返回未定义,但 record.mac 有效吗?

最佳答案

Table 组件的 rowKey 属性接受一个 function 或一个 string 如果它是一个单行表:

rowKey - Row's unique key, could be a string or function that returns a string string|Function(record):string

应该始终提供一个函数,例如,如果dataSource 具有key 属性:record => record.key

<Table columns={columns} dataSource={dataSource} rowKey={record => record.key} />;

关于javascript - antd table : why record. 键在我设置rowkey时返回undefined,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56896420/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com