胡博君簡單總結JS中的分享到代碼

來源:互聯網
上載者:User

胡博君簡單總結JS中的分享到代碼
var shareData = {
sTitle: Let's go! ,
sDesc: 我的牙都酸倒啦,
sContent: 你還等什麼!!!,
sImgurl: ,
sLink: ,
sCallback: http://mp.weixin.qq.com/s?__biz=MjM5NDE0MTEyNg==&mid=201488063&idx=1&sn=1ad91eb4dc1627fc0c8027e6472d646d#rd
};
document.addEventListener(WeixinJSBridgeReady,

function() {

//分享給朋友

WeixinJSBridge.on(menu:share:appmessage,
function(a) {
var b = shareData.sDesc.replace(/(s)+/g, );
if (userScore > 0) {
b += ,求超越!
}
WeixinJSBridge.invoke(sendAppMessage, {
img_url: shareData.sImgurl,
link: shareData.sLink,
desc: b,
title: shareData.sTitle
},
function(c) {
document.location.href = shareData.sCallback
})

});

//分享到朋友圈

WeixinJSBridge.on(menu:share:timeline,
function(a) {
var b = shareData.sContent.replace(/(s)+/g, );
if (userScore > 0) {
b = shareData.sDesc.replace(/(s)+/g, );
b += ,求超越!
}
WeixinJSBridge.invoke(shareTimeline, {
img_url: shareData.sImgurl,
img_width: 100,
img_height: 100,
link: shareData.sLink,
desc: b,
content: b,
title: b
},
function(c) {
document.location.href = shareData.sCallback
})

});

//分享到微博

WeixinJSBridge.on(menu:share:weibo,
function(a) {
WeixinJSBridge.invoke(shareWeibo, {
content: shareData.sDesc,
url: shareData.sLink
},
function(b) {
document.location.href = shareData.sCallback
})
})
},

false);

 

 

 

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.