[Vuejs]-Conditional styling in v-for vuejs

4👍

You can use class binding

update:
I missed the name of the day, I added what Jose Fernández suggested

template:

<tr
  v-for="(day, index) in days"
  :key="index"
  v-bind:class="{ active: day.format('dddd') == 'Saturday' }"
  class="grid-container"
>
  ...
</tr>

style:

<style scoped lang="scss">
.active {
  background-color: green;
}
</style>
👤Chris

1👍

I think what Chris replied is the finest solution. Although I think what you want to check is:

day.date.format("dddd") == 'Saturday'

Leave a comment