vue实现点击高亮效果
<view class="tabs"><textv-for="(item, index) in subTypes":key="item.id"class="text":class="{ active: index === activeIndex }"//动态绑定高亮类:判断下标是否等于当前下标@tap="activeIndex = index" //通过点击事件切换当前的下标赋给高亮下标>{{ item.title }}</text></view>
//默认 高亮的下标为第一个
const activeIndex = ref(0)