1,html
<div class="pagination" v-if="PageCount>0" style="position: absolute; right: 10px;bottom: 10px;">
<el-pagination
:total="TotalCount"
:page-sizes="[20, 50, 100, 200]"
:page-size="20"
layout="total, sizes, prev, pager, next"
@current-change="init"
@size-change="handleSizeChange"
>
</el-pagination>
</div>
2,初始接口,
created() {
this.$nextTick(() => {
this.init(1);
})
},
改变页码,会传入currentPage
init(currentPage){
console.log(119,currentPage)
this.PageIndex = currentPage
Methods.requestData(Api.url.aaa.bbb, {
PageIndex: this.PageIndex,
PageSize: this.PageSize,
3,调整页容量的时候
//调整页容量
handleSizeChange(val) {
this.PageSize = val;
this.PageIndex = 1
console.log(159,this.PageIndex)
this.init(this.PageIndex);
},