调用创建微信授权按钮时,授权按钮有时候显示有时候不显示

在同一手机上,laya调用创建微信授权按钮,代码执行了没有异常情况,有时候表示授权按钮,有时候不显示,以下是我创建按钮代码
var button:Object = wx.createUserInfoButton(
            {
                type: 'image',
                image: GameConfig.ServerUrl + 'static/playgame.png',
                style:
                {
                    right: 30,
                    bottom: 30,
                    width: 297*0.45,
                    height: 98*0.45,
                    lineHeight: 98*0.45,
                    backgroundColor: '#ff0000',
                    color: '#ffffff',
                    textAlign: 'center',
                    fontSize: 16,
                    borderRadius: 4,
                    withCredentials:false
                }
            });
            
            button.onTap(function(res):void
            {
                if(res.errMsg=="getUserInfo:ok")
                {
                    UserManager.userInfo = res.userInfo;
                    //清除微信授权按钮
                    button.hide()
                    MenuView.instance.createMenuBtn();
                    SocketManager.instance.sendlogin();
                    //LayaSample.gameLoad.toStartGame() 
                }
                else
                {
                    console.log("授权失败");
                }
            });
            button.show();
已邀请:

要回复问题请先

商务合作
商务合作