微信开发的基础配置

微信配置:
 <script>
            wx.config({

                debug: false,

                appId: '{{ appid }}',

                timestamp: '{{ timestamp }}',

                nonceStr: '{{ noncestr }}',

                signature: '{{ hash }}',

                jsApiList: [  //去掉别的传播类的接口

                    'hideOptionMenu',

                    'scanQRCode'

                ]

            });


            wx.ready(function() {

                wx.hideOptionMenu();//必须调用下  隐藏这些功能

                wx.hideMenuItems({

                    menuList: [

                        'menuItem:favorite',

                        'menuItem:copyUrl',

                        'menuItem:openWithQQBrowser',

                        'menuItem:openWithQQBrowser',

                        'menuItem:openWithSafari',

                        'menuItem:share:email',

                        'menuItem:share:facebook'

                    ] // 要隐藏的菜单项,只能隐藏“传播类”和“保护类”按钮,所有menu项见附录3

                });

            });


            wx.error(function(res){

                alert(res.resultStr);

            })


        </script>
  •  注:微信开发debug参数,当在调试阶段的时候,必须要debug参数必须要设置为true。

猜你喜欢

转载自demonli.iteye.com/blog/2350649