赞
踩
在 wx:for 循环中添加 data-index="{{index}}"
注:data-index="{{index}}" 必须在绑定 bindtap 点击事件的 view 才能生效
- <view wx:for="{{purchase}}" data-index="{{index}}" wx:key="unique" bindtap="detailPurchase">
- <text>{{item.planId}}</text>
- <view>详细地址:{{item.address}}</view>
- <view>{{item.timeStart}}~{{item.timeEnd}}</view>
- </view>
带参数跳转采购详情页面
- detailPurchase: function(event) {
- const index = event.currentTarget.dataset.index
- const planId = this.data.purchase[index].planId
- wx.switchTab({ url: `/pages/home/home?planId=${planId}`})
- },
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。