vueantdesigna-table的分页<a-table
:columns="columns" //列
:dataSource="tableDatas" //数据
:loading="loading"
:pagination="pagination" //分页属性
@change="handleTableChange"//点击分页中数字时触发的⽅法
:rowKey="tableDatas => tableDatas.id" //每⼀⾏的标识
>
<span slot="action" slot-scope="text, record"> //放表格中操作的按钮
<div class="tabBtn">
<a-popover placement="bottomRight" overlayClassName="tableBtn">
<template slot="title">
<a href="javascript:;" @click="handleAdd(record)">
<i class="iconfont icon-table-edit"/>编辑
</a>
<a href="javascript:;" @click="deleHostData(record)">
<i class="iconfont icon-tableEmpty"/>删除
</a>
</template>
<span>
<i class="iconfont icon-tableMore"/>
</span>
</a-popover>
</div>
</span>
</a-table>
//data中的数据
data() {
return {antdesignvue 表格合计
pagination: {
total: 0,
pageSize: 10,//每页中显⽰10条数据
showSizeChanger: true,
pageSizeOptions: ["10", "20", "50", "100"],//每页中显⽰的数据
showTotal: total => `共有 ${total} 条数据`, //分页中显⽰总的数据
},
loading: true,
// 查询参数
queryParam: {
page: 1,//第⼏页
size: 10,//每页中显⽰数据的条数
hosName: "",
hosCode: "",
province: "",
city: ""
},
};
handleTableChange(pagination) {
this.pagination.current = pagination.current;
this.pagination.pageSize = pagination.pageSize;
this.queryParam.page = pagination.current;
this.queryParam.size = pagination.pageSize;
},
//调⽤查询接⼝为dataSource 赋值
getTableList() {
this.loading = true;
retriveHosData(this.queryParam).then(res => {
if (ssage === "SUCCESS") {
const pagination = { ...this.pagination };
this.tableDatas = res.data.list;
this.pagination = pagination;
}
this.loading = false;
});
},
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论