<el-table :data="dataBox" style="width: 100%" @row-click="clickitemdata" :row-style="rowStyle" border v-loading="fullscreenLoading" @sort-change="sortChange" element-loading-text="拼命加载中"> <el-table-column prop="approveTime" sortable="custom" label="处理时间" min-width="120"></el-table-column> <el-table-column prop="createTime" sortable="custom" label="流程发起时间" min-width="120"></el-table-column> </el-table>
@sort-change="sortChange" 和 sortable="custom"
// 排序发生变化时 触发 sortChange(column) { let fun = (obj1, obj2) => { let val1 = obj1[column.prop] let val2 = obj2[column.prop] if (val1 && val2) { if (column.order == 'descending') { if (val1 > val2) { return 1; } else { return -1; } } else if (column.order == 'ascending') { if (val1 > val2) { return -1; } else { return 1; } } } else { return 0; } }
// allList 全部数据
this.allList.sort(fun); },