<el-table-column type="index" width="55" label="序号" :index="hIndex">
</el-table-column>
分页
<el-pagination
@size-change="handleSizeChange" @current-change="handleCurrentChange">
</el-pagination>
data中:
pageObj: {
pagesize: 10,
currpage: 1,
pageIndexCopy: 1,
},
方法中:
hIndex(index) {
// 当前页数 - 1 * 每页数据条数 + index + 1 ( index 是索引值,从0开始)
return (this.pageObj.pageIndexCopy - 1) * this.pageObj.pagesize + index + 1
},
handleCurrentChange(val) {
this.pageObj.currpage = val
this.pageObj.pageIndexCopy = val
},
其实正常后端也可以直接返回,前台就不用做这些了