微信sdk 隐藏右上角菜单项

wx.ready(function () {  
  // 8.3 批量隐藏菜单项  
    wx.hideMenuItems({  
      menuList: [  
        'menuItem:share:qq', //分享到QQ  
        'menuItem:share:weiboApp', // 分享到Weibo  
        'menuItem:favorite', // 收藏  
        'menuItem:share:QZone', // 分享到 QQ 空间  
        'menuItem:copyUrl', // 复制链接  
        'menuItem:openWithQQBrowser', // 在QQ浏览器中打开  
        'menuItem:openWithSafari', // 在Safari中打开  
        'menuItem:share:email', // 邮件  
        'menuItem:readMode', // 阅读模式  
        'menuItem:originPage' // 原网页  
      ],  
      success: function (res) {  
        //alert('已隐藏“阅读模式”,“分享到朋友圈”,“复制链接”等按钮');  
      },  
      fail: function (res) {  
        alert(JSON.stringify(res));  
      }  
    });  
      
    //获取“分享到朋友圈”按钮点击状态及自定义分享内容接口  
    wx.onMenuShareTimeline({  
        title: '', // 分享标题  
        link: '', // 分享链接  
        imgUrl: '', // 分享图标  
        success: function () {   
            // 用户确认分享后执行的回调函数  
        },  
        cancel: function () {   
            // 用户取消分享后执行的回调函数  
        }  
    });  
      
    //获取“分享给朋友”按钮点击状态及自定义分享内容接口  
    wx.onMenuShareAppMessage({  
        title: '', // 分享标题  
        desc: '', // 分享描述  
        link: '',  
        imgUrl: '', // 分享图标  
        type: 'link', // 分享类型,music、video或link,不填默认为link  
        dataUrl: '', // 如果type是music或video,则要提供数据链接,默认为空  
        success: function () {   
            // 用户确认分享后执行的回调函数  
        },  
        cancel: function () {   
            // 用户取消分享后执行的回调函数  
        }  
    });  
      
}); 

猜你喜欢

转载自www.cnblogs.com/DangerousBaymax/p/9224072.html
今日推荐