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

image.png