{
title: '序號(hào)',
dataIndex: 'index',
key: 'index',
align: 'center',
width: 50,
customRender: (text,record,index) => `${index+1}`,
},
使用customRender函數(shù)來(lái)渲染序號(hào)的數(shù)據(jù),在customRender函數(shù)中:
1、text:序號(hào)一列默認(rèn)顯示的數(shù)據(jù)
2、record:一行的所有數(shù)據(jù)
3、index:Table表格數(shù)據(jù)的下標(biāo),也就是數(shù)組的下標(biāo)
數(shù)組的下標(biāo)是從0開(kāi)始的,所以需要+1。
這樣設(shè)置不改變?cè)瓟?shù)據(jù)中序號(hào),只改變表格一頁(yè)的中所顯示數(shù)據(jù)的序號(hào):如一頁(yè)顯示10條數(shù)據(jù),那么本頁(yè)的序號(hào)則是從1~10。

image.png