
切换element-table分页的时候,序号如何累加,比如换第二页累加11.12.13
1.实时翻页改变index
<el-table-column type="index"
:index="indexMethod"
width="50" >
</el-table-column>
2、方法
indexMethod(index) {
return (this.pageNo-1)*this.pageSize+index+1;
}
其中this.pageNo和this.pageSize是自己定义的参数,代表当前处于第几页和当前页面的行数。
// (当前页 - 1) * 当前显示数据条数 + 当前行数据的索引 + 1
// (pageNum - 1) * pageSize + scope.$index + 1
<el-table-column label="序号" type="index" width="50" align="center">
<template slot-scope="scope">
{{(pageParams.pageNum - 1) * pageParams.pageSize + scope.$index + 1}}
</template>
</el-table-column>