[LayaAir 2.0]调用创建微信授权按钮时,授权按钮有时候显示有时候不显示
在同一手机上,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();
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();
没有找到相关结果
已邀请:
2 个回复
Aar0n
赞同来自:
问题找到 了!授权按钮只能用left,top,不能用right,bottom定位
Aar0n
赞同来自: