< img ng-src = "{{picture.imgpath}}" ng-click = "previewpics(picture.imgpath)">
2. WeChat ウィンドウ終了イベント 、例は次のとおりです:
3. ウェブリンクを友達、モーメント、Weibo に共有します
コードをコピー コードは次のとおりです:
var lineLink = 'http://../..',
imgUrl = 'http://../..',
shareTitle = 'Page title',
descContent='Content introduction',
appid = '';
//Determine whether WeChat js is supported
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);//Share friends
WeixinJsBridgeReady.on('menu:share:timeline',wx_shareTimeline);//Share to Moments
WeixinJsBridgeReady.on('menu:share:weibo',wx_shareWeibo);//Share friends
}
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',{
"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_shareWeibo (){
WeixinJsBridge.invoke('sendWeibo',{
"appid":appid,
"img_url":imgurl,
"img_width":'640',
"img_height":'500',
"link":lineLink,
"desc":descContent,
"title":shareTitle
},function(res){
console.log(res.err_msg);
}
})
}
4. Hide the button in the upper right corner of the web page
WeixinJsBridge.call('hideOptionMenu');
5. Hide the navigation bar at the bottom of the web page
WeixinJsBridge.call('hideToolbar');
6. Get the current network connection type:
WeixinJsBridge.invoke('getNetworkType',{},function(e){
console.log(e.err_msg);
})
7. Users are prohibited from sharing
WeixinJsBridge.invoke('disabledShare',{},function(e){
})
8. Determine whether to open in WeChat built-in browser
// true or false
var flag = WeixinApi.openInWeixin();
The above 8 items are what this article will share with you. I hope it will be helpful to everyone’s WeChat development.