微信小程序页面带参数跳转及接收参数内容navigator

时间:2019-01-06 16:28:30   收藏:0   阅读:1082

功能从index页面跳转到draw页面,并在draw页面获取id及imgUrl 
index.wxml

<navigator class=‘looks-view‘ wx:for="{{imgUrlNew}}" wx:key="index" url="/pages/draw/draw?id={{item.id}}&imgUrl={{item.img}}">
     <image src=‘{{item.img}}‘ class=‘looks-view-image‘></image>
     <text class=‘looks-view-text‘>{{item.name}}</text>
</navigator>

在draw.js中:

data: {
id:‘‘,
imgUrl:‘‘
},
onLoad: function (options) {
    this.setData({
      id: options.id,
      imgUrl: options.imgUrl
    })
  },

 

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!