computed: {
newdataList: function() {
return this.sortKey(this.dataList, "addtime");
}
},
methods: {
sortKey(array, key) {
return array.sort(function(a, b) {
var x = a[key];
var y = b[key];
return x > y ? - : x < y ? : ;
});
},
} this.dataList为数据源
computed: {
newdataList: function() {
return this.sortKey(this.dataList, "addtime");
}
},
methods: {
sortKey(array, key) {
return array.sort(function(a, b) {
var x = a[key];
var y = b[key];
return x > y ? - : x < y ? : ;
});
},
} this.dataList为数据源