data里
isActive:-1,
method里
checkedItem(index){
this.isActive=index;
},
页面里
<div v-for="(item,index) in nameoptions" v-bind:class="{active:index==isActive}" @click="checkItem(index)>{{item.name}}</div>
data里isActive:-1,method里checkedItem(index){this.isActive=index;},页面里<div v-for="(item,index) in nameoptions" v-bind:class="{active:index==isActive}" @click="checkItem(index)>{{item.name}}&...
data里
isActive:-1,
method里
checkedItem(index){
this.isActive=index;
},
页面里
<div v-for="(item,index) in nameoptions" v-bind:class="{active:index==isActive}" @click="checkItem(index)>{{item.name}}</div>
转载于:https://www.cnblogs.com/thinkingthigh/p/7603867.html
更多推荐
所有评论(0)