基于Vue的UI框架element el-table表格的自定义排序

html部分:
<el-table-column
prop="phoneCache"
label="手机缓存包编号"
align="center"
:sortable="true"
:sort-method="sortByVesselName"
width="140">
</el-table-column>
 
js部分:
sortByVesselName(obj1, obj2) {
let num1 = obj1.phoneCache.substring(2);
let num2 = obj2.phoneCache.substring(2);
return num1-num2;
}
 
去除掉字符串,使数字进行排序可以在排序方法中自定义自己想要的排序逻辑。
posted on 2020-07-17 12:18  蟑螂恶霸G  阅读(5140)  评论(0编辑  收藏  举报