
- 发布:2022-10-31 03:11
- 更新:2022-10-31 09:51
- 阅读:328
【报Bug】uni.getSystemInfoSync().windowWidth uni.getSystemInfoSync().windowHeight获取屏幕宽高不准确
产品分类: uniapp/App
PC开发环境操作系统: Mac
PC开发环境操作系统版本号: macOSmonterey 12.6
HBuilderX类型: 正式
HBuilderX版本号: 3.6.4
手机系统: 全部
手机厂商: 华为
页面类型: vue
vue版本: vue2
打包方式: 云端
项目创建方式: HBuilderX
测试过的手机:
示例代码:
onResize() {
let that = this;
uni.getSystemInfo({
success: function(res) {
console.log('屏幕旋转1:', res.windowHeight);
console.log('屏幕旋转2:', res.windowWidth);
that.changeScreenResize(res.deviceType, res.windowWidth, res.windowHeight, res.statusBarHeight);
}
});
},
onResize() {
let that = this;
uni.getSystemInfo({
success: function(res) {
console.log('屏幕旋转1:', res.windowHeight);
console.log('屏幕旋转2:', res.windowWidth);
that.changeScreenResize(res.deviceType, res.windowWidth, res.windowHeight, res.statusBarHeight);
}
});
},
操作步骤:
1.uni.getSystemInfoSync().windowHeight
2.uni.getSystemInfoSync().windowWidth
3.onResize onReady onLoad
1.uni.getSystemInfoSync().windowHeight
2.uni.getSystemInfoSync().windowWidth
3.onResize onReady onLoad
预期结果:
请官方协助 api返回值不准确 是什么原因
请官方协助 api返回值不准确 是什么原因
实际结果:
官方 api返回值准确
官方 api返回值准确
bug描述:
今天突然在app工程里通过uni.getSystemInfoSync().windowHeight和uni.getSystemInfoSync().windowWidth获取屏幕 宽高 横屏状态返回 的值全部是错的,在onResize onReady onLoad方法里获取的都是错误的 而且之前云打包已发布的app也有问题 请问官方这是什么情况?

FullStack - 【插件开发】【专治疑难杂症】【ios上架、马甲包、白包、过审、已成功上架过几百个】【多款插件已上架:https://ext.dcloud.net.cn/publisher?id=22130】【非诚勿扰】QQ:543610866
屏幕大小使用:screenWidth,
windowWidth是可使用窗口宽度
chinacoal (作者)
使用screenWidth也不行 横屏状态下获取的屏幕宽高是不正确的 宽和高居然一样 不过在demo上是可以的 横竖屏切换的时候获取的宽高值一样 不清楚是为什么
2022-10-31 09:57