微信小程序for循环中传递动态参数

for循环中的参数,没法传到对应的 js里,所以直接在 wxml页面上跳转

发送参数的 wxml页面

<view class="uploader" wx:for="{{bookList}}" wx:for-item = "item">
  <navigator url="../catalog/catalog?id={{item.id}}&title={{item.title}}" open-type="navigate" class="uploader-text">
    <text>{{item.title}}</text>
  </navigator>
</view>

接收参数的 js文件

Page({
  data: {title:''},
  onLoad: function (options) {
      this.setData({
        title: options.title
    })
  }
})

原创文章,欢迎转载,转载请注明出处!

猜你喜欢

转载自www.cnblogs.com/acm-bingzi/p/wechat_param.html
今日推荐