提交 0972d19b 编写于 作者: Q qiang

fix: 解决 iOS 横屏时获取屏幕和窗口宽度信息错误的问题 question/95997

上级 27bc27d7
......@@ -16,8 +16,10 @@ const isIOS = /iphone|ipad|ipod/i.test(ua)
export function getSystemInfoSync () {
var screen = window.screen
var pixelRatio = window.devicePixelRatio
var screenWidth = screen.width
var screenHeight = screen.height
// 横屏时 iOS 获取的屏幕宽高颠倒,进行纠正
var landscape = Math.abs(window.orientation) === 90
var screenWidth = Math[landscape ? 'max' : 'min'](screen.width, screen.height)
var screenHeight = Math[landscape ? 'min' : 'max'](screen.height, screen.width)
var windowWidth = Math.min(window.innerWidth, document.documentElement.clientWidth, screenWidth)
var windowHeight = window.innerHeight
var language = navigator.language
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册