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