search

Home  >  Q&A  >  body text

javascript - Is WeChat jssdk custom sharing unavailable?

debug:ok The safe domain name has also been added. The official account is also a service account. I am so confused. The most important thing is that the WeChat developer tool is passed and displayed correctly.

<script src='http://res.wx.qq.com/open/js/jweixin-1.0.0.js'></script>
<script>
    $.getJSON('获取data接口', function(data) {
        data.jsApiList = ['onMenuShareTimeline','onMenuShareAppMessage'];
        wx.config(data);
        wx.ready(function () {
            wx.showOptionMenu();
            wx.onMenuShareTimeline({
                title: '分享标题', // 分享标题
                link: '分享链接', // 分享链接
                imgUrl: '分享图标', // 分享图标
                success: function (res) {
                    alert(JSON.stringify(res));
                },
                cancel:function (res) {
                    alert(JSON.stringify(res));
                },
                fail: function (res) {
                    alert(JSON.stringify(res));
                }
            });

            wx.onMenuShareAppMessage({
                title: '分享标题', // 分享标题
                desc: '分享描述', // 分享描述
                link: '分享链接', // 分享链接
                imgUrl: '分享图标', // 分享图标
                success: function (res) {
                    alert(JSON.stringify(res));
                },
                cancel: function (res) {
                    alert(JSON.stringify(res));
                },
                fail: function (res) {
                    alert(JSON.stringify(res));
                }
            });

        });
    });
</script>
漂亮男人漂亮男人2807 days ago530

reply all(1)I'll reply

  • 阿神

    阿神2017-05-16 13:36:06

    wx.onMenuShareTimeline({
        title: '分享标题', // 分享标题
        link: '分享链接', // 分享链接
        imgUrl: '分享图标', // 分享图标
        success: function (res) {
            alert(JSON.stringify(res));
        },
        cancel:function (res) {
            alert(JSON.stringify(res));
        },
        fail: function (res) {
            alert(JSON.stringify(res));
        }
    });

    link Is it the same domain name as the safe domain name?

    What is the result of success, cancel, fail callback execution on the mobile phone?


    I have answered similar questions to yours before
    /q/10...

    Simply wonderful. . . . = =

    1. https://mp.weixin.qq.com/wiki...

    2. https://mp.weixin.qq.com/wiki...

    3. https://mp.weixin.qq.com/wiki

    reply
    0
  • Cancelreply