关闭微信页面与微信分享等配置

//这个可以关闭安卓系统的手机
document.addEventListener('WeixinJSBridgeReady', function(){
    WeixinJSBridge.call('closeWindow'); }, false);
//这个可以关闭ios系统的手机
WeixinJSBridge.call('closeWindow');

wx.config({
    debug: false,
    appId: appId,
    timestamp: timestamp,
    nonceStr: nonceStr,
    signature: signature,
    jsApiList: [
        'checkJsApi',
        'openLocation',
        'getLocation',
        'onMenuShareTimeline',
        'onMenuShareAppMessage',
        'showMenuItems',
        'showMenuItems',
        'hideOptionMenu'
    ] });

wx.ready(function () {

    wx.checkJsApi({ 
        jsApiList: [ 'checkJsApi', 'openLocation', 'getLocation', 'onMenuShareTimeline', 'onMenuShareAppMessage', 'showMenuItems', 'hideOptionMenu' ],
        success: function (res) {
            console.log(JSON.stringify(res));
       // 隐藏所有菜单项
            wx.hideOptionMenu();
            // 要隐藏的菜单项,只能隐藏“传播类”和“保护类”按钮
            wx.hideMenuItems({
                menuList: ['menuItem:share:timeline', 'menuItem:share:qq', 'menuItem:favorite', 'menuItem:share:QZone','menuItem:openWithSafari']});
            //显示某个菜单项
            wx.showMenuItems({
                menuList: ['menuItem:share:appMessage']
            });
        },

    });
});

wx.error(function (res) {
  console.log("error:");
  console.log(res);
  console.log(res.errMsg);
});                

 

posted @ 2020-07-09 16:07  echolife  阅读(411)  评论(0编辑  收藏  举报