The mini program has its own dedicated routing method. After the basic library 2.7.3, the mini program specifically implements its own unique page parameter passing method, the success attribute in wx.navigateTo(). Of course, this method now only supports Use of wx.navigateTo()
Related document links: https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.navigateTo.html
Usage examples are as follows
Page A
wx.navigateTo({ url: 'pages/pageB', success: function(res) { // 通过eventChannel向被打开页面传送数据 res.eventChannel.emit('goPageB', { pageDataA: '页面A传递到页面B的数据' }) } })
Page B
onLoad: function(){ const eventChannel = this.getOpenerEventChannel() // 监听goPageB事件,获取上一页面通过eventChannel传送到当前页面的数据 eventChannel.on('goPageB', function(data) { console.log('页面A传递的数据:',data) }) }
This small program’s unique parameter passing method is slightly more troublesome than splicing url parameters. Some, but there is no need to perform relevant conversion of parameters, nor to process some special strings
Recommended tutorial: "WeChat Mini Program"
The above is the detailed content of WeChat mini program's unique method of passing parameters between pages. For more information, please follow other related articles on the PHP Chinese website!