H5页面分享不显示自定义标题和图片,jssdk无报错,微信开发者工具正常,真机调试不显示分享按钮?
发布于 4 年前 作者 jie79 3428 次浏览 来自 问答

H5页面分享不显示自定义标题和图片,jssdk无报错,微信开发者工具里面一切正常,真机调试情况:

机型:荣耀20s,系统:鸿蒙2.0,微信版本:8.0.16 ,问题:不显示“分享给朋友”的按钮

机型:iphone6s,系统:ios14.7.1,微信版本:8.0.16 ,问题:显示分享按钮,但是不显示自定义标题和图标

测试地址:http://demo.fit365.top/h5/test.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>分享测试</title>
    <script src="https://libs.baidu.com/jquery/2.1.4/jquery.min.js"></script>
    <script src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
</head>
<body>
<h1>hello world!</h1>
</body>
<script>
    $.ajax({
        url:"/wap/index/jssdk",
        data:{
            url:window.location.href
        },
        type:"POST",
        dataType:"json",
        success:function(res){
            console.log(res)
            wx.config({
                debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
                appId: res.data.appId, // 必填,公众号的唯一标识
                timestamp: res.data.timestamp, // 必填,生成签名的时间戳
                nonceStr:res.data.noncestr, // 必填,生成签名的随机串
                signature: res.data.sign,// 必填,签名
                jsApiList: res.data.jsApiList // 必填,需要使用的JS接口列表
            });
            wx.ready(function(){
                wx.updateAppMessageShareData({
                    desc: "DJUUU",
                    imgUrl: "http://demo.fit365.top/h5/logo-black.png",
                    link: window.location.href,
                    title: "DJUUU",
                    success: function () {

                    }
                });
                wx.onMenuShareAppMessage({
                    desc: "DJUUU",
                    imgUrl: "http://demo.fit365.top/h5/logo-black.png",
                    link: window.location.href,
                    title: "DJUUU",
                    type: 'link', // 分享类型,music、video或link,不填默认为link
                    dataUrl: '', // 如果type是music或video,则要提供数据链接,默认为空
                    success: function () {
                        // 用户点击了分享后执行的回调函数
                    }
                });
            });
        }
    })
</script>
</html>
回到顶部