1.循环事件用wx:for,点击事件用bindtap,通过data-xxxx自定义标签传值
<scroll-view class="scroll-view_H scrollview" scroll-x="true" style="width: 100%">
<view class="classList"
wx:for="{ {classList}}"
wx:key="index"
data-item="{ {item}}"
bindtap="onClassList">{ {item.name}}</view>
</scroll-view>
js写法
// 菜单
onClassList (e) {
var item = e.currentTarget.dataset.item // 获取到自定义标签所传过来的值
console.log('点击&