使用element-ui 遇到的问题

Pagination 分页

在使用分页的时候,每次切换pageSize的时候,需要把current-page置为1 重新加载数据。

但是当current-page !== 1的时候,修改current-page的值,这时就会触发current-change事件。

如果current-page===1的时候,则不会触发current-change事件。

所以我们在进行changeSize的时候。需要进行current的判断。

handleSizeChange(val) {
  this.pgParam.pageSize = val
    if (this.pgParam.pageNum !== 1) {
      this.pgParam.pageNum = 1
    } else {
   this.handleGetImageList()
  }
},
handleCurrentChange(val) {
  this.pgParam.pageNum = val
  this.handleGetImageList()
},

 

原文地址:https://www.cnblogs.com/isylar/p/9511243.html