I'm trying to set a dynamic class in a vue.js, something like
<strong :class=`color-${category.level}`>{{ category.name }}</strong>
this html is inside a for loop and I need the category.value on this loop but it's not working
The bound class value should be wrapped by quotes :class='...' or double-quotes :class="..." :
<strong :class="`color-${category.level}`"></strong>
Add function in :class in your case
:class="switchClass(category.level)"
and then in methods
switchClass(level) {
return `color-${level}`
}