[Vuejs]-Can't display Images that are uploaded to firebase Store in the right order

0👍

If you want to maintain the order, I think Promise.all() is going to be helpful.

Here is how I’d do it:

async created () {
   const imageNames = await this.getImageNames();
   const imageUrls = await Promise.all(
       imageNames.map(imageName => this.getDownloadURL(imageName))
   );

   console.log(imageUrls)
}

imageNames.map(imageName => this.getDownloadURL(imageName)) will create an array of promises.
The promises will all start at the same time, but will get resolved in the order that they appear.

Leave a comment