注意#
按照 React 的規(guī)范,所有的組件數(shù)組必須綁定 key。在 Table 中,dataSource 和 columns 里的數(shù)據(jù)值都需要指定 key 值。對(duì)于 dataSource 默認(rèn)將每列數(shù)據(jù)的 key 屬性作為唯一的標(biāo)識(shí)。如果你的數(shù)據(jù)沒(méi)有這個(gè)屬性,務(wù)必使用 rowKey 來(lái)指定數(shù)據(jù)列的主鍵。
// 比如你的數(shù)據(jù)主鍵是 uid
return <Table rowKey="uid" />;
// 或
return <Table rowKey={record => record.uid} />;