[Vuejs]-VueJS v-repeat only once

0๐Ÿ‘

โœ…

If each company has many images and you only want the first image to show, here is a solution:

<div v-repeat="company in companies">
    {{company.name}}
    <img v-attr="src: company.images[0].url"> 
    {{company.images[0].name}}
</div>

0๐Ÿ‘

I am not entirely sure if this is what you are after, but here goes:

<div v-repeat="company: companies">
{{company.name}}
   <div>
     <img v-attr="src: company.image.url"/> 
     {{company.image.name}}
   </div>
</div>

this is assuming there is one image per company

Leave a comment