1 表格前面序号的写法:
<el-table>
<el-table-column
lable="序号"
width="50"
align="center"
type="index"
:index="indexMethod"
>
</el-table-column>
</el-table>
// 方法
indexMethod(index) {
// this.pageSize是每页的条数,this.currentPage是当前页数,index 是传过来的每条的索引
return this.pageSize *(this.currentPage - 1) + index + 1
},
2 有时候分页传偏移量时,需要传每页的第一个索引,比如每页条数是10的话;第一页传1,第二页传11,以此类推,那么偏移量的写法就是:
let params = {
start:this.pageSize *(this.currentPage - 1) + 1,
}