1.次のように、写真を表示するために左右にスライドします。
JS効果
コードコピーは次のとおりです。
var picture = [];
angular.foreach(pitctures、function(k、i){
写真[i] = k.imgpath;
});
$ scope.previewpics = function(currenturl){
if(typeof windof.weixinjsbridge!= 'undefined'){
// wechat画像コレクションを表示します
weixinjsbridge.invoke( 'imagepreview'、{
「現在」:currenturl、//現在のアドレス
「URLS」:写真//グループ
});
} それ以外 {
alert( "wechat"、null、function(){})をチェックしてください。
}
}
ページ要素:
コードコピーは次のとおりです。
<div>
<div ng-repeat = "info.infocontent.pitctures"> "Picture in info.infocontent">
<img ng-src = "{{picture.imgpath}}" ng-click = "previewpics(picture.imgpath)">
</div>
</div>
2。以下に示すように、WeChatウィンドウを閉じるイベントを閉じます。
コードコピーは次のとおりです。
weixinjsbridge.invoke( 'closewindow'、{}、function(res){
//alert(res.err_msg);
});
3.友達、サークルオブフレンズ、ワイボへのWebページリンクを共有する
コードコピーは次のとおりです。
var linelink = 'http://../ ..'、
imgurl = 'http://../ ..'、
Sharetitle = 'Page Title'、
desccontent = 'コンテンツの紹介'、
appid = '';
// WeChat 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);
}
}それ以外{
onbridgeready();
}
function onbridgeready(){
weixinjsbridgeready.on( 'メニュー:共有:appmessage'、wx_sharefriend); //友達を共有します
weixinjsbridgeready.on( 'メニュー:共有:タイムライン'、wx_sharetimeline); // share friends circle
weixinjsbridgeready.on( 'メニュー:共有:weibo'、wx_shareweibo); //友達を共有します
}
関数wx_sharefriend(){
weixinjsbridge.invoke( 'sendappmessage'、{
「appid」:appid、
「img_url」:imgurl、
「img_width」: '640'、
「img_height」: '500'、
「リンク」:Linelink、
「desc」:desccontent、
「タイトル」:Sharetitle
}、function(res){
console.log(res.err_msg);
}
});
}
関数wx_sharetimeline(){
weixinjsbridge.invoke( 'sendtimeline'、{
「appid」:appid、
「img_url」:imgurl、
「img_width」: '640'、
「img_height」: '500'、
「リンク」:Linelink、
「desc」:desccontent、
「タイトル」:Sharetitle
}、function(res){
console.log(res.err_msg);
}
})
}
関数wx_shareweibo(){
weixinjsbridge.invoke( 'sendweibo'、{
「appid」:appid、
「img_url」:imgurl、
「img_width」: '640'、
「img_height」: '500'、
「リンク」:Linelink、
「desc」:desccontent、
「タイトル」:Sharetitle
}、function(res){
console.log(res.err_msg);
}
})
}
4。ウェブページの右上隅にあるボタンを非表示
コードコピーは次のとおりです。
weixinjsbridge.call( 'hideoptionmenu');
5.ウェブページの下部にあるナビゲーションバーを非表示
コードコピーは次のとおりです。
weixinjsbridge.call( 'hidetoolbar');
6.現在のネットワーク接続タイプを取得します。
コードコピーは次のとおりです。
weixinjsbridge.invoke( 'getnetworktype'、{}、function(e){
console.log(e.err_msg);
})
7.ユーザーの共有を禁止します
コードコピーは次のとおりです。
weixinjsbridge.invoke( 'disabledshare'、{}、function(e){
})
8。WeChatの組み込みブラウザで開いているかどうかを判断します
コードコピーは次のとおりです。
// trueまたはfalse
var flag = weixinapi.openinweixin();
上記の8つの項目は、この記事で共有されるコンテンツです。 WeChatの開発に役立つことを願っています。