[Vuejs]-Get multiple values from array fetch

0👍

Here is an example on how to fetch an API and display it’s info by looping on the items: https://codesandbox.io/s/lucid-currying-nsoo3?file=/src/App.vue

Basically, get the results (an array so), then loop on each iteration of this array and display the wished data accordingly with something like

<div v-for="result in fetchedResults" :key="result.id">
  <p>
    <span>Name: {{ result.username }}</span> ~
    <span>email: {{ result.email }}</span>
  </p>
</div>

Btw, don’t forget the key, it’s important. More info here about this point.
Official documentation’s examples on how to loop on an array.

Leave a comment