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 ? -1 : x < y ? 1 : 0; }); }, }
this.dataList为数据源
转载于:https://www.cnblogs.com/huanhuan55/p/10095606.html