vue中v-for循环列表中如何将样式绑定在某一列上

1:html

<div class="bd7 flex-row">
<span class="word3 flex-col" v-for="(item, index) in datalist" :class="currentClass(index)" v-on:click="jgClick(item.num,index)">{{item.num}}元</span>
</div>

2:script

data: {
isActived: 0

}

jgClick: function (num,index) {
this.total = num
this.isActived = index
},
currentClass: function (index) {
console.log(index)
return this.isActived == index ? 'active' : '';
}

上一篇:离线数仓(一)


下一篇:一次线上事故,让我对MySql的时间戳存char(10)还是int(10)有了全新的认识