收藏
回答

JSSKD问题 VUE中使用jssdk进行分享功能失效?


提示 updateAppMessageShareData:ok
 // 获取wxSDK配置
            WeChatSDK(){
                // 获取当前域名
                console.log(window.location.href.split("#")[0]);
                this.$api.WeChatJsSDK({
                    urlwindow.location.href.split("#")[0]
                })
                .then(res => {
                    console.log(res);
                    console.log(res.data.jsApiList[3]);
                    wx.config({
                        debug:true,
                        appId:res.data.appId,
                        timestamp:res.data.timestamp,
                        nonceStr:res.data.nonceStr,
                        signature:res.data.signature,
                        jsApiList:[
                            // "updateAppMessageShareData",
                            res.data.jsApiList[3]
                        ], // 必填,需要使用的JS接口列表
                    });


                    wx.ready(function(){
                        wx.updateAppMessageShareData({
                            titlethis.fenxianga_toubu, // 分享标题
                            descthis.fenxianga_desc, // 分享描述
                            linkthis.fenxianga_link, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
                            imgUrlthis.fenxianga_imgUrl, // 分享图标
                            successfunction (){
                                console.log("成功");
                            }
                        })
                    });
                })
                .catch(err => {
                    console.log(err);
                })
            },


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

1 个回答

  • MORNINGSTART(tiezhu)
    MORNINGSTART(tiezhu)
    2021-07-20

    config成功了?

    放个链接上来嘛

    2021-07-20
    有用 1
    回复 2
    • 村上春树
      村上春树
      2021-07-20
      已经解决了  因为赋值的title等等都是undefined 一开始没往这方向想 谢谢
      2021-07-20
      回复
    • MORNINGSTART(tiezhu)
      MORNINGSTART(tiezhu)
      2021-07-20回复村上春树
      解决了就好
      2021-07-20
      回复
登录 后发表内容