阅读 181

vue点击高亮切换

<div class="item" v-for="(item,index) in bean_list" :key="index" @click="bean_num(index)" :class="{active:active == index}">
    <h3>{{item.money}}</h3>
    <p>{{item.price}}积分</p>
</div>

active: 0, //高亮切换,默认索引0高亮

bean_num(index) {
    this.active = index;//高亮切换
},
复制代码