前端排序 :
<el-table-column prop="total_fee" sortable :sort-orders="[‘descending‘,‘ascending‘]" align="center" label="收入情况"> </el-table-column>
后端排序;
1.表格行
<el-table-column prop="transfer" :sortable="‘custom‘" align="center" label="转账汇款"> </el-table-column>
2.表格
<el-table key="3" align="center" v-if="type===1" class="table1" stripe show-summary :summary-method="getSummaries" @sort-change="changeTableSort1" :header-cell-style="headerCellStyle" :data="tableData">
3.方法
data 数据
// 排序 1: 总金额 2:支付宝 3:微信 4:贝宝 5:转账 6: 退款 7: 定金 8 :尾款 incomeSort: { "total": 1, "ali": 2, "wx": 3, "paypal": 4, "transfer": 5, "refund": 6, "depositFee": 7, "finalPayFee": 8, },
changeTableSort1 (column) { this.orderField = column.order === ‘ascending‘ ? -this.incomeSort[column.prop] : (column.order === ‘descending‘ ? this.incomeSort[column.prop] : ‘‘) if (this.orderField) { this.getListHand() } },
this.getListHand() 是后端接口
原文:https://www.cnblogs.com/guangzhou11/p/14330471.html