微信小程序 参数传递实例代码
微信小程序参数传递实例代码
1、通过事件传递参数
实例代码:
Page({ evenName:function(e){ //获得点击事件传递的id console.log(e.target.dataset.id); })
2、通过页面跳转传递参数
页面1:
wx.navigateTo({
url:'/pages/scan-order/scan-order?scanId='+variable
})
页面2:/pages/scan-order/scan-order
Page({
onLoad:function(e){
this.setData({
userScanId:e.scanId
})
}
})
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!