[Vuejs]-Change element background-image inside a v-for

1👍

You should be able to do it like this:

<div v-for="item in projectsList" class="li" >
  <div :style="{ 'background-image': `url(${item.frontmatter.image})` }">
    <a :href="item.path" class="li">
      <span>{{ item.title }}</span>
    </a>
  </div>
</div>

No data function needed here I think.

👤ajobi

Leave a comment