[Vuejs]-How to fetch media data for each loop item

0👍

you have 2 possibilities!

  1. once (I guess in the mounted) loaded with data of the clues, load in another prop the data of the media
this.mediaClues = await Promise.all(
      this.clues.map((clue) => fetchMediaClue(this.route.params.id, clue.id))
    );
  1. make a component that autonomously loads data from the API
<div v-for="clue in clues" :key="clue.id">
[{clue.name}}
<media-component :clue-id="clue.id" :other-prop="route.params.id" /> 
</div>

Leave a comment