[Vuejs]-Class with string literals in Vue, HTML

4👍

This should work:

<v-alert
  v-for="i in counter"
  :key="i"
  :class="`mt-${i}`" 
>
  Wrong Password
</v-alert>

See this example

👤tauzN

0👍

you can bind the class -> :class="’mt-${i}‘" the tildas ` should be around the ${i} only and an apostrophe around the whole name ‘mt-yourcode’

Leave a comment