arr=[
{'name':'小冰火人','name1':'已完成','value1':306,'value2':309,'value3':100},
{'name':'preen','name1':'订单数量','value1':1159,'value2':1190,'value3':100},
{'name':'杨浦品越浓','name1':'完成率','value1':237,'value2':237,'value3':100},
{'name':'你好啊','name1':null,'value1':186,'value2':192,'value3':100},
{'name':'你不好','name1':null,'value1':1833,'value2':2036,'value3':100}
]
var sortArr = function(obj1, obj2) {
var val1 = obj1.value1;
var val2 = obj2.value1;
if(val1 > val2) {
return -1;
} else if(val1 < val2) {
return 1;
} else {
return 0;
}
}
arr.sort(sortArr)
image.png
网友评论