HTML: (页面展示)
<el-pagination
v-if="total"
class="page-box"
@current-change="pageChange"
layout="prev, pager, next"
:page-size="pageSize"
:total="total">
</el-pagination>
<el-button class="save-btn default" type="default" size="small" style="margin-bottom: 20px;" @click="listPagePayTrans('isQuery')" v-if="!isNight">查询</el-button>
data: (声明){
pageSize: 20,
pageNumber: 1,
total: 0,
}
mounted:{
this.listPagePayTrans(); // 初始化渲染
}
methods: (方法)
pageChange (size) {
this.currentPage = size
this.pageNumber = size
this.listPagePayTrans();
}
调用接口方法时:
listPagePayTrans(isQuery){
// 查账
if(this.pageName == 'workTable'){
this.selectMoney();
}
// 如果是查询 讲页码修改为 1
if(isQuery == 'isQuery'){
this.pageNumber = 1
// 设置页码激活
this.currentPage = 1
}
// 传值 (赋值)
data:{
pageSize: this.pageSize,
pageNumber: this.pageNumber
query() // 调用查询接口
}
}
成功时赋值:
this.total = Number(res.result.total)