Sorted according to array a property

The use of scenarios: the back-end data transmission back not sorted, sorted according to their own front-end array, an attribute of an object

the this .project.map ((Item) => { 
     item.gradeList.map ((innerItem) => {
          IF (innerItem.madelList) { 
            innerItem.madelList.sort (function (A, B) { 
                return the parseInt (a.medalType ) - the parseInt (b.medalType)   // corresponds to the sort () in ab &, medalType property is ordered
  }) } }) })

 

Guess you like

Origin www.cnblogs.com/qdlhj/p/11301979.html