收藏
回答

如何接受分享卡片中的参数?

基于uniapp做的一个h5页面,通过js-sdk生成微信分享卡片,当被分享用户点击卡片进入页面时,如何获取链接中带的参数,例如下面获取openid这个参数

wx.updateAppMessageShareData({

title: "ChatFox", 

desc: "ChatFox", 

link: urlLink,//比如是这种格式 "http://ai.shsening.com/gpth5/#/index/home?openid=0000000"

imgUrl: "@/static/h5/download-app/ios.png",

success: function () {

 // 设置成功

 console.log('成功')

}

 })

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

1 个回答

  • momo
    momo
    2023-05-17

    页面内onLoad里面接收参数

    2023-05-17
    有用
    回复 4
    • sheepcircle
      sheepcircle
      发表于移动端
      2023-05-17
      这个好像是分享时参数丢失了 我在分享的地方填的是http://ai.shsening.com/gpth5/#/pages/index/home?openid=2222222 但是我点击卡片进去后,页面的路径就变成了 http://ai.shsening.com/gpth5/#/pages/index/home 这个不太清楚是什么原因
      2023-05-17
      回复
    • momo
      momo
      2023-05-17回复sheepcircle
      不会啊,我也是Uniapp做过公众号的
      2023-05-17
      回复
    • sheepcircle
      sheepcircle
      发表于移动端
      2023-05-17回复momo
      我是用的location.href获取的当前页面地址,获取打印出来是没有问好和问好后面的东西的
      2023-05-17
      回复
    • momo
      momo
      2023-05-17回复sheepcircle
      使用onLoad接收试试
      2023-05-17
      回复
登录 后发表内容