小程序 - 动态绑定 class 样式 | vue - 动态绑定 class样式
效果图
先写一个改变之后的样式
.active {
border-bottom: 2px solid #f00;
color: red;
}
在xxx.js 里边写下要点击的下边
currentIndex:0,
在 view 里边写 class 样式
<view
wx:for="{{label}}"
wx:key="{{index}}"
class="{{index==currentIndex? 'active':''
原创
2020-08-11 08:45:13 ·
1221 阅读 ·
0 评论