Micro letter applet page jump pass parameters

 sender

the let Data = event.currentTarget.dataset.id (parameters to be transmitted)
wx.navigateTo({
url: '../iteminfo/iteminfo? id=' + encodeURI(JSON.stringify( data)),
})
// encodeURI: encoding data transfer (data transfer fear is parsed into code)
 
receiver
// Lifecycle function - monitor page load transfer from the data receiving options
 
data: {
  inid:""
},
onLoad: function (options) {
// If you do not pass the data to determine whether the data transfer is not executed
  if (options. id) {
    this.setData({
      inid: JSON.parse(decodeURI(options. id))
    })
    console.log(this.data.inid)
  }
},
 
 
Note that the one-parameter variable name
id

Guess you like

Origin www.cnblogs.com/lsyy2017/p/11616184.html