<a-table
bordered
:data-source="dataSource"
:columns="columns"
:pagination="pagination" //分页处理
:rowKey='dataSource => dataSource.id' //key报错
@change="tableChange" //加入change
>
</a-table>
columns: [{
title: "编号",
align: "center", // 设置文本居中的属性
scopedSlots: { customRender: "action" },
customRender:(text,record,index)=>`${(this.pagination.current-1)*this.pagination.defaultPageSize + (index+1)}`
}]
// 分页处理
pagination: {
total: 0,
showTotal: (total) => `共 ${total} 条`, // 显示总数
current: 1, // 默认当前页数
defaultPageSize: 6, // 默认当前页显示数据的大小
showQuickJumper: true,
},
tableChange(pagination, filters, sorter){
this.pagination = pagination;
},
Ant Design table编号自增及key报错处理
最新推荐文章于 2024-07-07 13:40:08 发布