[Vuejs]-V-for loop show only most recent upload

0👍

As mentioned by @Stephan Thomas in his comment, I would emphasize on not using v-for in this case.

A v-for renders your views on a loop therefore all items on your licenses variable will be rendered. Since you’d like to show ONLY the most recent upload, I suggest you grab it by the index manually.

Assuming licenses is an Array and the required item is at index 0, use something like:

<div v-if="licenses.length > 0"> <!-- check if array not empty -->
<img :src="licenses[0]" class="upload" /> <!-- get access -->
</div>

Leave a comment