[{name:‘爸爸’,category_class:0}{name:妈妈,category_class:1}]
this.form.formlistTwo.sort((x,y)=>{
return x.category_class - y.category_class
})
var array = [0,1,5,10,15];
array.sort();//结果为:0,1,10,15,5
1
2
function act(a,b){
return a-b;//升序
};
function dact(a,b){
return b-a;//降序
};
array.sort(act)//结果为:0,1,5,10,15
array.sort(dact)//结果为:15,10,5,1,0