Vue点击当前增加class其他删除class
<li v-for="(item, index) in correList" v-on:click="clickTopUp(item.id)" v-bind:class='{actives:item.id==faceValue}'>{{item.money}}元<br><span&
·
<li v-for="(item, index) in correList" v-on:click="clickTopUp(item.id)" v-bind:class='{actives:item.id==faceValue}'>
{{item.money}}元<br><span>消耗{{item.integrals}}积分</span></li>
export default{
data () {
return {
faceValue: "0",
correList: '',
}
},
methods:{
clickTopUp:function(id){
this.faceValue = id;
console.log("id======",id)
}
},
.actives{
border: 1px solid #1e93ff;
color: #1e93ff;
}
更多推荐
已为社区贡献13条内容
所有评论(0)