How to use Vue + element-ui pagination?

The data in

paging is rendered dynamically, but when you click on paging, the currently clicked page will not be rendered. By default, the first page
below is normally displayed

.

clipboard.png

clipboard.png

clipboard.png
1,

clipboard.png

HTML

<div class="block">
   <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="query.currentPage" :page-size="query.pageSize" layout="total, prev, pager, next, jumper" :total="query.recordCount">
   </el-pagination>
</div> 

data () {

return {
  tableData: [],
  query: {
    pageNum: 1,
    pageSize: 10,
    currentPage: 1,
    recordCount: 1150
  }
};

},
methods: {

createTableData() {   
  this.$http
    .get(this.$api.tableData, { params: this.query.pageNum })
    .then(res => {
      if (res.status == 200) {
        this.tableData = res.data.data.pageBean.recordList;
        this.query.recordCount = res.data.data.pageBean.recordCount;
        this.query.pageSize = res.data.data.pageBean.pageSize;
        this.query.currentPage = res.data.data.pageBean.currentPage;
      }else {
        throw res.message;
      }
    })
    .catch(err => {
      console.log("createChartOne", err);
    });
},
// 
handleSizeChange(val) {
  console.log(` ${val} `);
},
handleCurrentChange(pageNum) {
  this.query.pageNum = pageNum;
  this.createTableData();
},
created() {
  this.createTableData();
  }
},
Feb.28,2021

doesn't see what's wrong. Does api return data to confirm that there is no problem?


1, question: the page value of the paging function you assign to this.query.pageNum, so the currentPage in your print this.query will always be 1.
2. For such a good browser as Google, you can view the API request parameters directly in the developer tool Network, which can be seen in Form Data under headers. So you can troubleshoot the problem.


parameter is wrong. The correct one is params: {pageNum: this.query.currentPage}

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b36f45-2c05d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b36f45-2c05d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?