From f4806267fa018d4a66267da92c3d6e075d5405af Mon Sep 17 00:00:00 2001 From: qiang Date: Fri, 17 Jul 2020 18:48:52 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E9=83=A8=E5=88=86?= =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E8=AE=BE=E5=A4=87=E6=A8=AA=E5=B1=8F=E6=97=B6?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=B1=8F=E5=B9=95=E5=AE=BD=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=88=E5=AF=BC=E8=87=B4=20rpx=20?= =?UTF-8?q?=E8=AE=A1=E7=AE=97=E9=94=99=E8=AF=AF=EF=BC=89=20fixed=20#1848?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/platforms/h5/service/api/device/get-system-info.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/platforms/h5/service/api/device/get-system-info.js b/src/platforms/h5/service/api/device/get-system-info.js index 8b4b008a..d8232940 100644 --- a/src/platforms/h5/service/api/device/get-system-info.js +++ b/src/platforms/h5/service/api/device/get-system-info.js @@ -17,9 +17,10 @@ export function getSystemInfoSync () { var screen = window.screen var pixelRatio = window.devicePixelRatio // 横屏时 iOS 获取的屏幕宽高颠倒,进行纠正 - var landscape = Math.abs(window.orientation) === 90 - var screenWidth = typeof window.orientation === 'number' ? Math[landscape ? 'max' : 'min'](screen.width, screen.height) : screen.width - var screenHeight = typeof window.orientation === 'number' ? Math[landscape ? 'min' : 'max'](screen.height, screen.width) : screen.height + const screenFix = /^Apple/.test(navigator.vendor) && typeof window.orientation === 'number' + const landscape = screenFix && Math.abs(window.orientation) === 90 + var screenWidth = screenFix ? Math[landscape ? 'max' : 'min'](screen.width, screen.height) : screen.width + var screenHeight = screenFix ? Math[landscape ? 'min' : 'max'](screen.height, screen.width) : screen.height var windowWidth = Math.min(window.innerWidth, document.documentElement.clientWidth, screenWidth) || screenWidth var windowHeight = window.innerHeight var language = navigator.language -- GitLab