el-table需要排序的列,加上“sortable”,
如果自己在前端或后端,已经处理过数据,将数据排好序,加上“sortable=“custom””就可以了。
代码如下:
<el-table
:data="tableData"
style="width: 100%;height:100%;padding: 20px;"
@sort-change="changeTableSort"
:default-sort = sortRule
:row-style="getRowClass"
:header-row-style="getRowClass"
:header-cell-style="getRowClass"
:row-class-name="tableRowClassName"
>
<el-table-column
label="排序"
align="center"
min-width="13%">
<template slot-scope="scope">
<span v-text="getIndex(scope.$index)"> </span>
</template>
</