小程序传id值

xml文件
<view class='bgcf bsbb pl30 pr30 pt30 pb30 df fww' >
      <block wx:for="{{introduction}}" wx:key="key">
      <view class='df fdc aic mb25 mr44 mw330' bindtap='departmentDetailClick' data-k_id='{{item.k_id}}'>         数据表中是什么id就写什么
     <view wx:for="{{item.child}}" wx:for-item="items" >
            <image mode='aspectFill' style='width:87rpx;height:87rpx;' src='{{items.k_thumb}}'></image>
     </view>
     <text class='fs26 c6 mt15'>{{item.k_name}}</text>
   </view>
</block>
</view>
JS文件
departmentDetailClick: function(e) {
 
console.log(e);
console.log(e.currentTarget.dataset.k_id)
var k_id = e.currentTarget.dataset.k_id
wx.navigateTo({
 
            url: '/hyb_zylxc/department_detail/department_detail?k_id=' + k_id,
})
},

猜你喜欢

转载自www.cnblogs.com/isuansuan/p/9812265.html