Answer the question
In order to leave comments, you need to log in
How to add class in vuejs?
The item.icon property specifies the name of the icon, for example icon-tv, it needs to be added to the section__icon class to end up with class="section__icon icon-tv"
In the documentation, I found only the v-bind:class="{'class-name" option ': true}"
But how to apply it in my situation is not clear
<div class="sections-list" v-for="(item, i) in sections">
<div class="section">
<div class="section__icon"></div>
<div class="section__title">{item.title}</div>
</div>
</div>
Answer the question
In order to leave comments, you need to log in
everything is clearly described in the documentation in this regard
:class=['class1', iconTv]
computed : {
iconTv () {
return "iconTv"}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question