效果:
点击当前元素添加 Class ,同时删除兄弟元素 Class
HTML
<view :class="{max:yijiIndex===index}" @click="yiIndex(index)"
v-for="(item,index) in arryiji">{{item}}</view>
Script
data() {
return {
arryiji: ["全部","一番赏","全局赏","双随机","幽奇赛"],
yijiIndex:0 ,
}
},
methods: {
yiIndex(index) {
this.yijiIndex=index
},
}
Css
.max {
width: 52px;
height: 32px;
opacity: 1;
color: rgba(26, 26, 26, 1);
font-size: 23px;
font-weight: 400;
font-family: "YouSheBiaoTiHei";
text-align: center;
line-height: 32px;
letter-spacing: 0;
white-space: nowrap;
z-index: 999;
}