微信网页开发,H5页面分享给好友,自定义内容无效?
发布于 5 年前 作者 vqiu 3946 次浏览 来自 官方Issues
代码为
jweixin.ready(function() {
        console.log(res,3333);
        console.log(jweixin);
        console.log(jweixin.onMenuShareAppMessage);
        jweixin.checkJsApi({
            jsApiList: ['updateAppMessageShareData'], // 需要检测的JS接口列表,所有JS接口列表见附录2,
            success: function(res) {
                console.log(res.checkResult);
                console.log(obj);
                jweixin.updateAppMessageShareData({
                    title: obj.title, // 分享标题
                    desc: obj.desc, // 分享描述
                    link: obj.link, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
                    imgUrl: obj.imgUrl, // 分享图标
                    success: function (res) {
                        callback(res);
                        console.log('asdfjka成功');
                    },
                    fail:function(res){
                        console.log(res,4444)
                    },
                    // complete:function(res){
                    // }
                });
                // 以键值对的形式返回,可用的api值true,不可用为false
                // 如:{"checkResult":{"chooseImage":true},"errMsg":"checkJsApi:ok"}
            }
        });

    });
});
t调用时
if (that.$wechat && that.$wechat.isWechat()) {
    console.log('$wechat=updateAppMessageShareData');
    that.$wechat.updateAppMessageShareData(og);
}
d但是分享后页面为原始链接,并且图片和描述文字无效

回到顶部