1、设置 pagination
<a-table class="tableDiv" bordered :dataSource="dataSource" :columns="columns" :pagination="pagination" />
2、自定义 pagination
data () {
columns: [
{
title: '序号',
dataIndex: 'num',
key: 'num',
width: 80,
customRender: (text, record, index) =>
`${(this.pagination.defaultCurrent - 1) * this.pagination.defaultPageSize + (index + 1)}`,
fixed: 'left',
align: 'center'
}
],
pagination: {
defaultCurrent: 1,
defaultPageSize: 10,
total: 0,
showSizeChanger: true,
pageSizeOptions: ['10', '20', '30', '50'],
showTotal: (total) => '共' + ` ${total} ` + '项',
buildOptionText: (size) => {
return Number(size.value) + ' 项' + '/' + '页'
}
}