.wxml中:
<view class='section'>
<scroll-view id='sv' scroll-y style="width:150rpx;height:{{hei}}px;">
<block wx:for="{{leftMenu}}"wx:key='this'>
<block wx:if="{{index == clickId}}">
<view bindtap='changeWhite' class='fff' id='{{index}}'>
{{item}}
</view>
</block>
<blockwx:else>
<view bindtap='changeWhite' class='eee' id='{{index}}'>
{{item}}
</view>
</block>
</block>
</scroll-view>
</view>
.js中
data: {
clickId:
0,
},
changeWhite:
function(res){
var cla = res.currentTarget.id;
console.log(res.currentTarget.id);
this.setData({
clickId:cla
})
},