loading...

js数组对象以某一对象排序

this.tableData.sort(this.compare('formateDate'))
    compare(property){  
        return function(a,b){
        var value1 = a[property];
        var value2 = b[property];
        return value2 - value1;
    }
}
posted @ 2020-12-27 19:15  robinloveslife  阅读(126)  评论(0编辑  收藏  举报