element el-table 添加分页连接的序号,清除sortable排序
作者:互联网
先看代码:
<el-table :data="tableData" style="width: 100%" stripe size="medium" @sort-change="changeSort"> <el-table-column label="序号" width="80"> <!-- 这是添加分页时有连接的序号 --> <template slot-scope="scope"><span>{{scope.$index+(currentPage - 1) *size + 1}} </span></template> </el-table-column> <!-- 这是添加排序 --> <el-table-column prop="date" label="时间" sortable="custom" ref="dateSort"> </el-table-column> </el-table> <!-- 分页 --> <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage" :page-sizes="[ 10, 20, 40]" :page-size="size" :total="total" ></el-pagination>1.序号
{{scope.$index+(currentPage - 1) *size + 1}}
2.清除排序
this.$refs.dateSort.columnConfig.order = '';标签:el,sortable,index,element,currentPage,序号,scope,排序,size 来源: https://www.cnblogs.com/wiliam/p/11990404.html