Template
<el-pagination
class="pagination"
@current-change="handleCurrentChange"
@size-change="handleSizeChange"
:current-page="currentPage"
:page-size="pageSize"
:page-sizes="pageSizes"
background
layout="sizes, prev, pager, next, jumper"
:total="reportedNum">
</el-pagination>
Data
data() {
return {
currentPage: 1,
pageSize: 1,
pageSizes:[1,2,3,4],
reportedNum: 0,
}
}
Methods
handleCurrentChange (val) {
this.currentPage = val
this.getAnswers((val - 1)*(this.pageSize), this.pageSize)
}
handleSizeChange(val) {
this.pageSize = val
this.getAnswers(0, val)
this.currentPage=1
}
getAnswers (offset, limit) {
........
}
效果图
