快速入口——界面设置:
<view class="tl-content" wx:for="{{h.list}}" wx:for-item="item" wx:key="index" bindtap='goDetails' data-id='{{item.id}}'>
快速入口——取值操作:
var id = e.currentTarget.dataset.id
wx.navigateTo({
url: `/pages/member/rechargeDetails/rechargeDetails?orderId=${id}`,
})
第二中类型 传递json
原文地址:https://blog.csdn.net/yin_xing_ye/article/details/81437573
<block wx:for-items="{{newGoods}}" wx:key="id">
<view catchtap="catchTapCategory" data-goodsid="{{item.id}}">
<view>
<image src="{{item.imgUrl}}" />
</view>
<view class="product-name">
{{item.name}}
</view>
</view>
</block>
这里的data-goodsid="{{item.id}}"相当于把id赋值给了goodsid
goodsid 这个参数不支持大写,如果用data-pId 然后var goodsId = e.currentTarget.dataset.pId;无法取到值
catchTapCategory: function (e) {
var that = this;
var goodsId = e.currentTarget.dataset.goodsid;
console.log('goodsId:' + goodsId);
wx.navigateTo({ url: '../detail/detail?goodsId=' + goodsId })
},
网友评论