<el-table
:data="tableData"
style="width: 100%"
v-loading="loading"
stripe
:default-sort = "{ prop: 'ghTime',order: 'ascending'}" //升序
@sort-change="changeTableSort" //根据点击按钮操作方法可操作后台接口数据
@selection-change="handleSelectionChange"
>
<el-table-column
type="index" //序号的类型
label="序号"
align="center"
width="50"
>
</el-table-column>
<el-table-column
prop="name"
label="名称"
width="150"
show-overflow-tooltip //超出尺寸小气泡显示
align="center">
</el-table-column>
<el-table-column
prop="ghTime"
label="时间"
width="150"
align="center"
sortable="custom" //根据自己的逻辑排序的必写custom
>
</el-table-column>
</el-table>
//点击后根据升序还是降序的按钮,调整访问表单的参数
changeTableSort(item) {
if(item.order == "descending"){
this.$set(this.queryParams.params, 'order', 3)
}else{
this.$set(this.queryParams.params, 'order', 1)
}
this.getList()
}
//handleSelectionChange 操作列表被选中的方法
//el-table复选框选中id
handleSelectionChange(val) {
let ids = []
for (let i = 0; i < val.length; i++) {
ids[i] = val[i].id
}
this.tableIdList = ids //ids的数据组
}

此上为效果图