JS-SDK开发时,wx.config一直invaild
<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<script>
wx.config({
beta: true,
debug: true,
appId: 'wx521922227e01c0ed',
timestamp: 1583198096,
nonceStr: 'database2yss',
signature: 'cc3078c418bbb6e786140774bc6e88f306cda784',
jsApiList: ['hideOptionMenu','hideMenuItems','onMenuShareAppMessage','onMenuShareTimeline','onMenuShareWechat','shareAppMessage','shareWechatMessage']
});
wx.ready(function () {
wx.hideOptionMenu();
wx.hideMenuItems({
menuList: ['menuItem:share:appMessage',
'menuItem:share:timeline',
// 'menuItem:share:email',
'menuItem:share:wechat',
// 'menuItem:openWithSafari',
// 'menuItem:copyUrl'
], // 要隐藏的菜单项
success: function (res) {
alert("隐藏");
}
});
});
wx.error(function(xhr,status,error){
console.log(error)
alert(error)
})
</script>
在html里直接这样写的,上边参数先用corpid和secret获取token然后再获取jsapi_ticket,拼上配置里一样的timestamp和nonceStr以及链接生成signature
。在用企业微信打开这个链接