<el-pagination style="margin-top:10px;" @size-change="sizeChangeHandle" @current-change="currentChangeHandle" :current-page="pageIndex" :page-sizes="[10, 20, 50, 100]" :page-size="pageSize" :total="totalPage" layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
size-change | pageSize 改变时会触发 | 每页条数 |
current-change | currentPage 改变时会触发 | 当前页 |
prev-click | 用户点击上一页按钮改变当前页后触发 | 当前页 |
next-click | 用户点击下一页按钮改变当前页后触发 | 当前页 |
data() {
return {
pageSize: 10,
pageIndex: 1,
totalPage: 0
};
},
// 每页数
sizeChangeHandle(val) {
this.pageSize = val;
this.pageIndex = 1;
this.getDataList();
},
// 当前页
currentChangeHandle(val) {
this.pageIndex = val;
this.getDataList();
},
getDataList() {
api
.Showlist({
// 分页
page: {
current: this.pageIndex,
size: this.pageSize
},
...this.dataForm,
})
.then(data => {
this.totalPage = data.data.total;
})
.catch(data => {
this.totalPage = 0;
});
},