[Vuejs]-How to handle style classes in Vue js?

0👍

I use in Vue the class binding to apply dynamic classes. You can see the doc here.

You define a binding for class and use an object as value, whre the key is the classes and the value is a boolean expression.

As example

<ul>
  <li v-for="item in menuItems"
      v-on:click="selected = item"
      v-bind:class="{ selected: selected == item}">
     {{item}}
  </li>
</ul>

Leave a comment