1、view中定义按钮,并定义data-movieid属性,绑定getDetail函数:
<view> <button class="movie-view" data-movieid="{{item.id}}" data-title="{{item.title}}" data-source="{{item.source}}" data-picurl="{{item.picUrl}}" data-desc="{{item.description}}" bindtap="getDetail">查看</button> </view>
2、getDetail函数:
getDetail: function(event) { wx.navigateTo({ url: `/pages/movie/detail/detail?id=${event.target.dataset.movieid}&title=${event.target.dataset.title}&source=${event.target.dataset.source}&picurl=${event.target.dataset.picurl}&desc=${event.target.dataset.desc}`, }) },