企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
~~~ //list 为js中data中获取的数据 <block wx:for="{{list}}" wx:key="index"> <!-- 将id一起传到跳转页面 data-id="{{item.postId}}--> <view class="conter" bindtap = "handClick" data-id="{{item.postId}}"> <view class="top"> <image src="{{item.imgUrltop}}"></image> <text>{{item.time}}</text> </view> <text class="title">{{item.title}}</text> <image class="img" src="{{item.imgUrlsrc}}"></image> <view class="bottom"> <image src="/images/icon/chat1.png"></image> <text>{{item.reading}}</text> <image src="/images/icon/view.png"></image> <text>{{item.collection}}</text> </view> </view> </block> ~~~ ~~~ js中代码 handClick(event){ //获取传来的参数 var id=event.currentTarget.dataset.id //console.log(event.currentTarget.dataset.id) wx.navigateTo({ url:"/pages/details/details?id="+id }); }, ~~~