前端——重写微信分享链接功能

微信分享链接功能

function weixinInit() {
    let img = "https://front-images.oss-cn-hangzhou.aliyuncs.com/i4/f855cb1d548e4c6c44202c472d16c837-110-110.jpg"
    let link = "https://uat.yuantutech.com/tms/hcrm/transfer.php?transferKey=4&corpId=8888&unionId=3517"
    let con = "description"
    let tit = "title"
    document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
        WeixinJSBridge.on('menu:share:appmessage', function (argv) {
            WeixinJSBridge.invoke('sendAppMessage', {
                "appid": "wxd0773e308e4bc5fc",
                "img_url": img,
                "img_width": "160",
                "img_height": "160",
                "link": link,
                "desc": con,
                "title": tit
            }, function (res) {
                //...回调部分
            })
        });
        // 分享到朋友圈
        WeixinJSBridge.on('menu:share:timeline', function (argv) {
            WeixinJSBridge.invoke('shareTimeline', {
                "img_url": img,
                "img_width": "160",
                "img_height": "160",
                "link": link,
                "desc": con,
                "title": tit
            }, function (res) {
                // ...回调部分
            });
        });
    }, false)
}

你可能感兴趣的:(前端——重写微信分享链接功能)