What is the best way to apply a class on a list item when hovering over it and remove the class when leaving?
<li class="test" @mouseenter="thumbStyle" @mouseleave="thumbStyle2">1</li>
<li class="test" @mouseenter="thumbStyle" @mouseleave="thumbStyle2">2</li>
<li class="test" @mouseenter="thumbStyle" @mouseleave="thumbStyle2">3</li>
In data & methods
data(){
isActive:false
}
thumbStyle:function(){
this.isActive = true;
},
thumbStyle2:function(){
this.isActive = false;
},
I have attempted to do this, but only the first list element (li) gets the class applied when hovering over any list item. What technique should be used to target each individual li
being hovered over? Similar to using $(this)
in jQuery.