// html
<el-table-column
prop="description"
label="备注"
width="250"
:sortable="true"
:sort-method="(a,b) => sortMethod(a ,b , 'description')"
show-overflow-tooltip
>
<template slot-scope="scope">
<span>{{scope.row.description}}</span>
</template>
</el-table-column>
// js
sortMethod(obj1, obj2) {
// console.log(obj1, obj2)
const val1 = obj1.description ? 1 : 0
const val2 = obj2.description ? 1 : 0
return val1 - val2
},
网友评论