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 8b4b008ac316bbb31ead9bb1f7934f607d964c59..d8232940fc591b6fb4d64b9abdc42d7b723089de 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