How does Vue ensure that paging is performed after asynchronously fetching all the data?

drop-down refresh, how to ensure that paging is performed after all data is obtained asynchronously?

// 
refresh() {
  // getOrderList
  this.getOrderList();

  // this.orderList.length, , 
  if (this.orderList.length > 0) {
    console.log("this.orderList", this.orderList);
    this.$toast("");
    this.isLoading = false;
  }
}
Apr.09,2022

you can use async and await. Synchronize


put the code of your if segment in the getOrderList method to get the data. It's best to encapsulate the method


getOrderList to return a Promise . Just put the code in then directly here.

Menu