收藏
回答

navigateToMiniProgram跳转成功,获取数据提示错误?

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)

  },




回答关注问题邀请回答
收藏

4 个回答

  • 相
    2020-05-15
    在app,js   onShow中
      onShowfunction (res{
        
        console.log('test',res.query.mm)
    
    
      },
    

    获取参数后,怎样在pages/index/index页面中显示

    2020-05-15
    有用
    回复 1
    • xplee
      xplee
      2020-05-15
      存到storage里面,在页面再从storage里取出来
      2020-05-15
      回复
  • Admin ²º²⁴
    Admin ²º²⁴
    2020-05-15
    extraData
    需要传递给目标小程序的数据,目标小程序可在 App.onLaunch,App.onShow 中获取到这份数据。
    
    2020-05-15
    有用
    回复
  • 子不语
    子不语
    2020-05-15

    page.onShow 没用参数

    请学会如何「提问」(👈戳我)

    2020-05-15
    有用
    回复
  • xplee
    xplee
    2020-05-15

    onShow()是没有参数一说的,所以res是不存在的

    2020-05-15
    有用
    回复
登录 后发表内容
问题标签