updateAppMessageShareData分享不出去?
发布于 3 年前 作者 penggang 12449 次浏览 来自 官方Issues

updateAppMessageShareData

组件调用成功,分享时闪一下就退回来了,再点就无反映了

// 分享配置
                  $this.$axios
                    .get(
                      $this.$store.state.wxApi +
                        "/wxsign?url=" +
                        window.location.href
                    )
                    .then(function (wxresponse) {
                      window.wxConfig.timestamp = wxresponse.data.timestamp;
                      window.wxConfig.nonceStr = wxresponse.data.nonceStr;
                      window.wxConfig.signature = wxresponse.data.signature;
                      window.wx.config(window.wxConfig); // wx初始化配置
                      window.wx.ready(function () {
                        //需在用户可能点击分享按钮前就先调用
                        window.wx.updateAppMessageShareData({
                          title: $this.coupon.name, // 分享标题
                          desc: $this.coupon.memo, // 分享描述
                          link:
                            $this.$store.state.domain +
                            "/d1/" +
                            id +
                            "?code=" +
                            $this.code, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
                          imgUrl: $this.coupon.poster, // 分享图标
                          success: function () {
                            // 设置成功
                          },
                        });
                        window.wx.updateTimelineShareData({
                          title: $this.coupon.name, // 分享标题
                          link:
                            $this.$store.state.domain +
                            "/d1/" +
                            id +
                            "?code=" +
                            $this.code, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
                          imgUrl: $this.coupon.poster, // 分享图标
                          success: function () {
                            // 设置成功
                          },
                        });
                      });
                    })
                    .catch(function (error) {
                      console.log(error);
                    });
1 回复

updateAppMessageShareData 这个是自定义分享内容的,不是调起分享

回到顶部