小程序跨页面传递对象数组的示例:
传递页面,代码:
click: function(e) {
var model = JSON.stringify(e.currentTarget.dataset.model);
//将数组还是对象转换成字符串,传递到下一个页面
wx.navigateTo({
url: '../detail/detail?model=' + model,
})
}
接收页面,代码:
onLoad:function(options){varbean=JSON.parse(options.model);
//将字符串转换成数组还是对象
this.setData({
model:bean
})
},
本文来源:https://www.yuntue.com/post/80164.html | 云服务器网,转载请注明出处!