The problem of index calculation on the second page of element ui table

The sequence number of the second page of the

element ui table does not start with 6. I don"t know why index recalculated

again.
Apr.05,2021

pagination is equivalent to a new set of data for each page. Of course, starting from 1 with your own, just recalculate it yourself

<el-table-column
   type="index"
   :index="getIndex"
   fixed
   width="80">
 </el-table-column>
 
 data () {
   return {
     currentPage: 1,
     perPage: 10,
   }
 }
 
 getIndex (index) {
   return (this.currentPage - 1) * this.perPage + index + 1
 }

that's the line number. Who knew you were going to page it.

    <el-table-column
      type="index"
      :index="indexMethod">
    </el-table-column>
indexMethod(index) {
        return index + this.page*this.pageSize;
      }
Menu