How to get the data of a row after element paging and paging

after the table is paged, click on the preview of a row after turning to the second page, and you will get the data of the corresponding row of one page, but the data list of the paged page is correct

.

pagination on the table
: data= "testpage.slice ((currentPage-1) pagesize,currentPage pagesize)"

< el-pagination background

@size-change="handleSizeChange" 
@current-change="handleCurrentChange"  
:current-page="currentPage"  
:page-sizes="[5,10,15]"
:page-size="pagesize"   
layout="total,jumper,prev, pager, next,sizes"
:total="testpage.length" >

< / el-pagination >

Preview button
< el-button @ click= "yulan (scope.$index,scope.row)" > Preview < / el-button >
/ / Preview
yulan (index,row) {

let self=this;            

/ / this.$message ("Preview" + (index+1) + "Line")

let iData = this.testpage[index];    //    
console.log(iData.peo)
console.log(iData)            

},
/ / pagination
/ initial page currentPage, initial number of data per page pagesize and data testpage
handleSizeChange:function (size) {

this.pagesize=size;

},
handleCurrentChange:function (currentPage) {

this.currentPage=currentPage;

}

Apr.01,2021

your index here is still the index, of the first page, and you do not count the number of pages in the calculation, so you still get the data of the corresponding row of the first page. For example, if you want to get the data of a row on the second page, your index needs to add the length of the first page to-1, and then you can get your real data

.
Menu