[Vuejs]-How to bind an image inside v-for

0๐Ÿ‘

โœ…

You need to bind the objectโ€™s property without brackets e.g

<div class="image"><img :src="portfolio.thumbnail.src" :alt="portfolio.thumbnail.alt" class="img-fluid">

0๐Ÿ‘

I think your code should be like this.

<div v-for="(portfolio,index) in portfolios" :key="index" >
      <img :src="require(`img/portfolio-${index+1}.jpg`)" :alt="portfolio.thumbnail.alt" />
</div>

Leave a comment