• 前端实现禁用微信的分享菜单和启用菜单


    一、页面加载禁用用户的分享菜单

    function onBridgeReady() {
             WeixinJSBridge.call('hideOptionMenu');
    }
    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();
                }
    

      

    二、ios不兼容,ios可能会把所有的页面都禁用,在需要显示分享菜单的页面加上以下代码

    document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {  
                  WeixinJSBridge.call('showOptionMenu');//显示右上角菜单
                });
    

      

    以下代码有问题,不用看

    <script src="./jweixin.js" type="text/javascript" charset="utf-8">script>
    <script type="text/javascript" charset="utf-8">
      wx.config({
        "debug":false,
        "beta":false,
        "jsApiList":["openEnterpriseChat","openChatWithMsg","selectExternalContact","openUserProfile","thirdPartyOpenPage","getCurExternalContact","onMenuShareTimeline","onMenuShareAppMessage","hideOptionMenu","hideMenuItems"],
        "appId":"xxx",
        "nonceStr":"xxxx",
        "timestamp":xxxx,
        "url":"xxxx",
        "signature":"xxxx"
      });
      wx.ready(function() {
        wx.hideOptionMenu();
        wx.hideMenuItems();
      });
    script>
    

      

  • 相关阅读:
    Hadoop源代码点滴-自然常数e
    Hadoop点滴-Hadoop的IO
    Hadoop点滴-HDFS文件系统
    Hadoop点滴-HDFS命令行接口
    EasyUI
    EasyUI
    EasyUI
    EasyUI
    EasyUI
    EasyUI
  • 原文地址:https://www.cnblogs.com/deng-jie/p/13470127.html
Copyright © 2020-2023  润新知