7***@qq.com
7***@qq.com
  • 发布:2024-09-24 12:58
  • 更新:2024-09-24 12:58
  • 阅读:67

【报Bug】在安卓平板下横屏获取uni.getSystemInfoSync().screenHeight和uni.getSystemInfoSync().screenWidth数据不多。

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: windows12

HBuilderX类型: 正式

HBuilderX版本号: 4.24

手机系统: Android

手机系统版本号: Android 12

手机厂商: 荣耀

手机机型: V7

页面类型: vue

vue版本: vue2

打包方式: 云端

项目创建方式: HBuilderX

示例代码:

onResize(){
let width = uni.getSystemInfoSync().screenWidth;
let height = uni.getSystemInfoSync().screenHeight;
console.error(width+"横竖屏"+height)
}

操作步骤:

新建一页页面,监听onResize方法,输出getSystemInfoSync

预期结果:

横屏:宽1000 高 600
竖屏:高1000 宽600

实际结果:

横屏:宽1000 高 1000
竖屏:高1000 宽600

bug描述:

当竖屏时获取的系统getSystemInfoSync为
{
"SDKVersion": "",
"appId": "",
"appLanguage": "zh-Hans",
"appName": "e,
"appVersion": "1.4.8",
"appVersionCode": 100,
"appWgtVersion": "1.4.8",
"brand": "honor",
"browserName": "chrome",
"browserVersion": "92.0.4515.105",
"deviceBrand": "honor",
"deviceId": "6BBC14BB416CFE3F7994564B5295A358",
"deviceModel": "KRJ2-W09",
"deviceOrientation": "portrait",
"devicePixelRatio": 2,
"deviceType": "pad",
"errMsg": "getSystemInfoSync:ok",
"language": "zh-CN",
"model": "KRJ2-W09",
"oaid": "",
"osAndroidAPILevel": 31,
"osLanguage": "zh-CN",
"osName": "android",
"osTheme": "light",
"osVersion": "12",
"pixelRatio": 2,
"platform": "android",
"romName": "HarmonyOS",
"romVersion": "",
"safeArea": {
"left": 0,
"right": 600,
"top": 0,
"bottom": 932,
"width": 600,
"height": 932
},
"safeAreaInsets": {
"top": 0,
"right": 0,
"bottom": 0,
"left": 0
},
"screenHeight": 1000,
"screenWidth": 600,
"statusBarHeight": 24,
"system": "Android 12",
"ua": "Mozilla/5.0 (Linux; Android 12; KRJ2-W09 Build/HONORKRJ2-W09; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/92.0.4515.105 Safari/537.36 uni-app (Immersed/24.0)",
"uniCompileVersion": "4.24",
"uniPlatform": "app",
"uniRuntimeVersion": "4.24",
"version": "1.9.9.82145",
"windowBottom": 0,
"windowHeight": 932,
"windowTop": 0,
"windowWidth": 600
}
横屏时为
{
"SDKVersion": "",
"appId": "UNI2348E61",
"appLanguage": "zh-Hans",
"appName": "e会议",
"appVersion": "1.4.8",
"appVersionCode": 100,
"appWgtVersion": "1.4.8",
"brand": "honor",
"browserName": "chrome",
"browserVersion": "92.0.4515.105",
"deviceBrand": "honor",
"deviceId": "6BBC14BB416CFE3F7994564B5295A358",
"deviceModel": "KRJ2-W09",
"deviceOrientation": "portrait",
"devicePixelRatio": 2,
"deviceType": "pad",
"errMsg": "getSystemInfoSync:ok",
"language": "zh-CN",
"model": "KRJ2-W09",
"oaid": "",
"osAndroidAPILevel": 31,
"osLanguage": "zh-CN",
"osName": "android",
"osTheme": "light",
"osVersion": "12",
"pixelRatio": 2,
"platform": "android",
"romName": "HarmonyOS",
"romVersion": "",
"safeArea": {
"left": 0,
"right": 1000,
"top": 0,
"bottom": 932,
"width": 1000,
"height": 932
},
"safeAreaInsets": {
"top": 0,
"right": 0,
"bottom": 0,
"left": 0
},
"screenHeight": 1000,
"screenWidth": 1000,
"statusBarHeight": 24,
"system": "Android 12",
"ua": "Mozilla/5.0 (Linux; Android 12; KRJ2-W09 Build/HONORKRJ2-W09; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/92.0.4515.105 Safari/537.36 uni-app (Immersed/24.0)",
"uniCompileVersion": "4.24",
"uniPlatform": "app",
"uniRuntimeVersion": "4.24",
"version": "1.9.9.82145",
"windowBottom": 0,
"windowHeight": 932,
"windowTop": 0,
"windowWidth": 1000
}
对比之下:横竖屏的宽高对应不一,deviceOrientation也不对。

2024-09-24 12:58 负责人:无 分享
已邀请:

要回复问题请先登录注册