1、為table添加分頁: :pagination="pagination"
pagination: {
defaultPageSize: 10,
showTotal: (total) => `共${total} 條數據`,
total: 0,
showSizeChanger: true,
pageSizeOptions: ['10', '20', '50'],
onShowSizeChange: (current, pageSize) => {
this.pageSize = pageSize;
this.getTableData();
},
onChange: (page, pageSize) => {
this.pageSize = pageSize;
this.pageNum = page;
this.getTableData();
}
},
2、為table添加序號:在columns中: 添加一行: {"title": "序號",customRender: (value, row, index) => `${(this.pageNum-1)*10+index+1}`},
/**pageNum 當前第幾頁*/
3、 為table添加編輯、刪除功能
<template slot="sensorId" slot-scope="text, record, index">
<span>
<a-button @click.native="editTableRow(record)" size="small" type="link">編輯</a-button>
<a-button @click.native="removeTableRow(record)" size="small" type="link">刪除</a-button>
</span>
</template>