firebase sort reverse order

后端 未结 3 1527
深忆病人
深忆病人 2021-01-19 07:19

var playersRef = firebase.database().ref(\"team_mapping/\");


playersRef.orderByChild(\"score\").limitToFirst(7).on(\"child_added\", function(data) {
}
         


        
3条回答
  •  南笙
    南笙 (楼主)
    2021-01-19 07:53

    just use reverse() on the array , suppose if you are storing the values to an array items[] then do a this.items.reverse()

    ref.subscribe(snapshots => {
           this.items = [];
          snapshots.forEach(snapshot => {
    
            this.items.push(snapshot);
    
          });
          **this.items.reverse();**
        },
    

提交回复
热议问题