数组从大到小排序

 this.rightDataItem = [
          { name: '微信', color: '#06E1AE', money: formatMoney(dataRight.wx) },
          { name: '支付宝', color: '#0495FE', money: formatMoney(dataRight.ali) },
          { name: 'PayPal', color: '#FFC300', money: formatMoney(dataRight.paypal) },
          { name: '转账汇款', color: '#FF9403', money:  formatMoney(dataRight.transfer) },
          { name: '线下付款', color: '#B1B2FE', money: formatMoney(dataRight.offline) },
          { name: '钱包支付', color: '#F0579A', money: formatMoney(dataRight.wallet) }
        ]
        this.rightDataItem = this.rightDataItem.sort(this.sortDownDate)

 

方法:

  sortDownDate(a, b) {
        return  (b.money) - (a.money)
   },

 

posted @ 2021-01-06 13:59  1点  阅读(195)  评论(0编辑  收藏  举报