vue中使用WX JS SDK 进行分享朋友圈和好友,分享的链接后面的参数丢失,只有部分机型有问题!
发布于 5 年前 作者 kyu 707 次浏览 来自 问答
/**分享朋友圈和好友 */
    toShareMomentsAndFriends() {
      var url = `${window.location.origin}${window.location.pathname}?state=${encodeURI(state)}`
      var title = this.pageData.shareTitle
      wx.ready(function() {
        wx.updateAppMessageShareData({
          title: title,
          desc: '我在参加童妍记忆银行大咖宝贝挑赞赛,快来帮我点赞哦...',
          // link: url,
          link: 'https://clientserver.zhongyanimage.com/AlbumsLive/DetailNew?state=6010762_1⊱1⊱43369',
          imgUrl: 'https://objstorage.zhongyanimage.com/albumsLive/detailNew/shareImg.jpg',
          success: function(res) {
            // alert('分享好友')
          },
          cancel: function(res) {
            // alert('取消分享好友')
          },
          fail: function(res) {
            // alert('分享好友失败')
          }
        })
        wx.updateTimelineShareData({
          title: title,
          desc: '我在参加童妍记忆银行大咖宝贝挑赞赛,快来帮我点赞哦...',
          // link: url,
          link: 'https://clientserver.zhongyanimage.com/AlbumsLive/DetailNew?state=6010762_1⊱1⊱43369',
          imgUrl: 'https://objstorage.zhongyanimage.com/albumsLive/detailNew/shareImg.jpg',
          success: function(res) {
            // alert('分享到朋友圈成功')
          },
          cancel: function(res) {
            // alert('取消分享到朋友圈')
          },
          fail: function(res) {
            // alert('分享到朋友圈失败')
          }
        })
      })
    },

正确链接 https://clientserver.zhongyanimage.com/albumsLive/detailNew?state=0018170%E2%8A%B11%E2%8A%B133539

在当前手机上分享出去的链接为:https://clientserver.zhongyanimage.com/albumsLive/detailNew

前后对比,参数丢失。

场景:H5页面,VUE(2.6.10) weixin-js-sdk(1.6.0)

代码如上。

目前,XS MAX(15.1) 和红米K30 5G版(MIUI 12.5.7)两台手机微信版本都是8.0.16 可以进行正常的分享,链接参数不会丢失。

之前都没有出现这个问题。

还有一个问题就是正常打开链接后,点击三个点的菜单,然后点击复制链接,复制出来的链接后面也是不带参数的。

需要加急!!!加急!!!加急!!!

微信日志已经上传,时间大概在 2021年11月28号 18:02:10 左右

上传日志的微信号:lyh_Gerry

1 回复

你好,我们会尽快修复

回到顶部