iconfont使用数组遍历样式和动态改变样式
2021-03-26 本文已影响0人
爱学习的新一
iconfont.png
<div class="cell-list" :class="{cellActive:index==num}" v-for="(item,index) in menList" :key="index"
@click="menubtn(index,item.name)">
<i class="iconfont" :class="[item.Icon,{cellActive:index==num}]" ></i>
<span class="cell-span" :class="{cellActive:index==num}">{{item.name}}</span>
</div>
methods: {
menubtn(index,name){
console.log(name)
this.num = index
}