1.
<el-pagination
v-show="this.total > 0"
style="float: right"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="queryForm.page"
:page-sizes="[5, 10, 15, 20]"
:page-size="queryForm.limit"
layout="total, sizes, prev, pager, next, jumper"
:total="total"
>
</el-pagination>
2. 定义变量: total: 1,
handleSizeChange(val) {
console.log(val, "1111111111");
this.queryForm.limit = val;
this.getMyJbtsInfo(val, 1);
this.queryForm.page = 1;
},
handleCurrentChange(val) {
// 改变默认的页数
this.queryForm.page = val;
// 切换页码时,要获取每页显示的条数
this.getMyJbtsInfo(this.queryForm.limit, this.queryForm.page);
},
async getMyJbtsInfo(limit, page) {
this.queryForm.limit = limit;
this.queryForm.page = page;
let res = await getMyJbtsInfo(this.queryForm);
if (res.code != 200) {
return;
}
this.getMyJbtsInfoList = res.data.records;
this.total = Number(res.data.total);
},
mounted() {
this.getMyJbtsInfo(this.queryForm.limit, this.queryForm.page);
}