wx.navigateToMiniProgram({
appId: 'xxxxxxxxxxxxxxxxxxx',
path: 'page/index/index?id=123',//---------------path为空,能跳转,但写上路径,跳转 提示:“页面不存在”?????????
extraData: { //需要传递给目标小程序的数据,目标小程序可在 App.onLaunch(),App.onShow() 中获取到这份数据
test:9
},
envVersion: 'develop', //重点**要打开的小程序版本,有效值 develop(开发版),trial(体验版),release(正式版)
success(res) {
console.log('打开成功')// 打开成功
}
跳转成功后的页面
onShow: function (res) {
console.log('test0',res.query.mm) //用query获取数据,提示出现错误:VM109:1 thirdScriptError
Cannot read property 'query' of undefined;at "pages/mt/index" page lifeCycleMethod onShow function
TypeError: Cannot read property 'query' of undefined
at Se.onShow (http://127.0.0.1:22518/appservice/pages/mt/index.js:27:30)
at Se.<anonymous> (http://127.0.0.1:22518/appservice/__dev__/WAService.js:2:1747424)
at Se.p.__callPageLifeTime__ (http://127.0.0.1:22518/appservice/__dev__/WAService.js:2:1747169)
at xt (http://127.0.0.1:22518/appservice/__dev__/WAService.js:2:1762938)
at http://127.0.0.1:22518/appservice/__dev__/WAService.js:2:1766232
at Mt (http://127.0.0.1:22518/appservice/__dev__/WAService.js:2:1766725)
at Function.<anonymous> (http://127.0.0.1:22518/appservice/__dev__/WAService.js:2:1774830)
at i.<anonymous> (http://127.0.0.1:22518/appservice/__dev__/WAService.js:2:1738454)
at i.emit (http://127.0.0.1:22518/appservice/__dev__/WAService.js:2:615430)
at Object.emit (http://127.0.0.1:22518/appservice/__dev__/WAService.js:2:582139)
},
在app,js onShow中 onShow: function (res) { console.log('test',res.query.mm) },
获取参数后,怎样在pages/index/index页面中显示
page.onShow 没用参数
请学会如何「提问」(👈戳我)
onShow()是没有参数一说的,所以res是不存在的