mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-01 11:39:28 +08:00
Fix rowKey usages in List (#14437)
* correct rowKey usages in List * fix item type in renderItem in List
This commit is contained in:
parent
8f7d4970a5
commit
1f0166c156
@ -97,16 +97,16 @@ export default class List extends React.Component<ListProps> {
|
||||
};
|
||||
}
|
||||
|
||||
renderItem = (item: React.ReactElement<any>, index: number) => {
|
||||
const { dataSource, renderItem, rowKey } = this.props;
|
||||
renderItem = (item: any, index: number) => {
|
||||
const { renderItem, rowKey } = this.props;
|
||||
let key;
|
||||
|
||||
if (typeof rowKey === 'function') {
|
||||
key = rowKey(dataSource[index]);
|
||||
key = rowKey(item);
|
||||
} else if (typeof rowKey === 'string') {
|
||||
key = dataSource[rowKey];
|
||||
key = item[rowKey];
|
||||
} else {
|
||||
key = dataSource.key;
|
||||
key = item.key;
|
||||
}
|
||||
|
||||
if (!key) {
|
||||
|
Loading…
Reference in New Issue
Block a user