vue 点击当前元素改变样式

template

 <ul>
   <li v-for="(relation,index) in relations" v-bind:id="relation.id" v-bind:id="relation.id" v-bind:class="{checked:index==nowIndex}" v-on:click="relationClick(index)">
    <i>
  </ul>

data

nowIndex:0

methods

changeValue(index){
       this.isActive=index;
  }`

style

.checked{
  background: #eff4f7;
 }

原文:https://www.jb51.net/article/146114.htm

原文地址:https://www.cnblogs.com/ssjf/p/11169517.html