3 回复
为什么我用官方的事例代码,按钮却无法显示呢?我自己的代码也无法显示这个按钮。
let button = wx.createUserInfoButton({
type: 'text',
text: '获取用户信息',
style: {
left: 300,
top: 320,
width: 200,
height: 40,
lineHeight: 40,
backgroundColor: '#ff0000',
color: '#ffffff',
textAlign: 'center',
fontSize: 16,
borderRadius: 4
}
});
button.show();
cc.xdSdk.log('button:' + button);
button.onTap((res) => {
console.log(res);
});
你可以使用 wx.getSystemInfoSync() 接口来获取到屏幕的相关信息。
var sysInfo = wx.getSystemInfoSync();var windowW = sysInfo.windowWidth;var windowH = sysInfo.windowHeight; |
获取到屏幕真正的宽高像素值
