微信小程序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
    })
  }
})

 

原創文章,歡迎轉載,轉載請注明出處!


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM