1,页面中添加class
<li v-for="(item, index) in sortedList"
class="clearfix hoverStyle"
@click="handleClickTypeItem($event, index)" >
<span
v-show="!item.edit"
class="floatLeft"
:class="{ active: selectIndex == index }" >
{{ item.groupName }}
</span>
li/>
2,选中
handleClickTypeItem(event, index) {
this.selectIndex = index;
}
3,着色
.active {
color: #2f71a9;
font-size: 14px;
font-weight: 500;
}