页面
标题',
descContent='
内容简介',
appid = '';
//判断是否
支持微信js
if(typeof WeixinJsBridge == 'undefined'){
if(document.addEventListener){
document.addEventListener('WeixinJsBridgeReady',onBridgeReady,false);
}else if(document.attachEvent){
document.attachEvent('WeixinJsBridgeReady',onBridgeReady);
document.attachEvent('onWeixinJsBridgeReady',onBridgeReady);
}
}else{
onBridgeReady();
}
function onBridgeReady (){
WeixinJsBridgeReady.on('menu:share:appmessage',wx_shareFriend);//
分享朋友
WeixinJsBridgeReady.on('menu:share:timeline',wx_shareTimeline);//
分享到朋友圈
WeixinJsBridgeReady.on('menu:share:weibo',wx_shareWeibo);//
分享朋友
}
function wx_shareFriend (){
WeixinJsBridge.invoke('sendAppMessage',{
"appid":appid,
"img_url":imgurl,
"img_width":'640',
"img_height":'500',
"link":lineLink,
"desc":descContent,
"title":shareTitle
},function(res){
console.log(res.err_msg);
}
});
}
function wx_shareTimeline (){
WeixinJsBridge.invoke('sendTimeline',function(res){
console.log(res.err_msg);
}
})
}
function wx_shareWeibo (){
WeixinJsBridge.invoke('sendWeibo',function(res){
console.log(res.err_msg);
}
})
}