打开转发过来的小程序详情页,参数拿不到
发布于 6 年前 作者 rye 16441 次浏览 来自 问答

我遇到一个问题,转发小程序详情页时带了参数,在打开已转发的页面时,只有打开微信的调试面板才能拿到带过来的参数,哪位大神有遇到类似的问题么,求解答!

微信版本最新版

基础库版本:1.6

3 回复

麻烦提供一个复现代码

不打开调试的话,通过setData更新debug信息到界面,请自行调试下

后来发现参数可以拿到,现在遇到的问题是调用wx.getImageInfo的时候在打开调试的情况下可以调用成功,不打开调试时调用的话就卡在那了,成功和失败的回调都不进入,这个怎么解?

launchFromShare: function(options){
      let shareData = JSON.parse(options.shareData)
      let imgUrl = shareData.imgSrc.replace(/https|http/g,'https')
      this.setData({
        categoryList: shareData.categoryList,
        frameInfo: shareData.frameInfo,
        tipsContent: '加载中...',
        imgInfo: {
          src: imgUrl
        }
      });
      console.log(imgUrl)
      wx.showModal({
        title: 'imgUrl',
        content: imgUrl,
        showCancel: false,
        confirmText: '知道了',
      })
      wx.getImageInfo({
        src: shareData.imgSrc,
        success: (res) => {
          wx.showModal({
            title: '图片下载成功',
            content: res.path,
            showCancel: false,
            confirmText: '知道了',
          })
          app.globalData.imgInfo.tempFilePath = res.path;
          this.setData({
            uploadedFileStatus: true,
            detectedStatus: true
          })
        },
        fail: (err) => {
          wx.showModal({
            title: '图片下载失败',
            content: err,
            showCancel: false,
            confirmText: '知道了',
          })
          console.log(err)
        }
      })
  },
回到顶部