微信小程序页面跳转传递参数(实体,对象)
我们要传递的实体是object类型
queryItemClick: function (e) { var that = this //拿到点击的index下标 var index = e.currentTarget.dataset.index //将对象转为string var queryBean = JSON.stringify(that.data.queryList[index]) wx.navigateTo({ url: '../queryResult/queryResult?queryBean=' + queryBean, }) }
然后我们再接收
onLoad: function (options) { var that=this var queryBean = JSON.parse(options.queryBean); that.setData({ queryBean: queryBean }) //console.log(that.data.queryBean) }