Vue implementation. Check li to mark class as cur,. The class of other li remains unchanged.

problem description

if there are three li, I choose the second one, the second one adds a class to cur, the other two li remain the same
jquery, it is easy to implement, there is $(this). Addclass, and you can removeClass another
VUE that is not selected. Ask for advice

    <li class="nameLi" v-for="i in name">{{ i }} </li>

how to write JS for VUE?

Sep.01,2021

is controlled by one variable: class= "nameLi value? 'active':'"
value is the variable in data nameLi and active is the class name

.
Menu