<block wx:for="{{menu}}" wx:for-item="items" wx:key="{{index}}">
<view class="menu-commen" data-lockerid='{{items.text}}' bindtap='toNext'>
<view class="commen-view center">
<view class="center {{index==nowChoose?'scroll-commen1':'scroll-commen2'}}">
<text class="{{index==nowChoose?'menu-text1':'menu-text2'}}">{{items.text}}</text>
</view>
</view>
</view>
</block>
设置点击某一个,设置点击的某一个topChoose的值为当前的inde即可。
点击事件如下:
toNext: function(e) {
var that = this;
var value = e.currentTarget.dataset.lockerid;
switch (value) {
case "全部":
app.globalData.myGoodsType = "";
that.setData({
nowChoose: 0
})
break;
}
}