效果:升序:
降序:
升序是:a.value-b.value
降序是:b.value-a.value
代码:
let arrObj=[{"name": "银行转账","value": 2},{"name": "支付宝支付","value": 1},{"name": "微信支付","value": 0}
]
arrObj.sort((a,b)=>{ return a.value-b.value})//升序
arrObj.sort((a,b)=>{ return b.value-a.value})//降序