button绑定事件:
<button size="default" type="primary" plain="true" bindtap="send" data-id="{{id}}" data-read-id="{{readId}}">事假传参</button>
传递参数:
send(e) {
console.log(e);
console.log(e.currentTarget.dataset.id);
console.log(e.currentTarget.dataset.readId);
var id = e.currentTarget.dataset.id;
var readId = e.currentTarget.dataset.readId;
wx.navigateTo({
url: '../index/index-item/index-item?readId=' + readId + '&id=' + id
})
},
接受参数:
<view>{{readId}}</view>
js:
onLoad: function(options) {
console.log(options);//通过options获取所有传过来的所有参数
var readId = options.readId;
this.setData({
readId: readId
})
},