Object wx.getWindowInfo()
获取窗口信息
基础库 2.20.1 开始支持,低版本需做兼容处理。
小程序插件:支持,需要小程序基础库版本不低于 2.21.3
返回值
Object
	| 
	 | 
	属性
	 | 
	类型
	 | 
	说明
	 | 
	| 
	 | 
	pixelRatio
	 | 
	number
	 | 
	设备像素比
	 | 
	| 
	 | 
	screenWidth
	 | 
	number
	 | 
	屏幕宽度,单位px
	 | 
	| 
	 | 
	screenHeight
	 | 
	number
	 | 
	屏幕高度,单位px
	 | 
	| 
	 | 
	windowWidth
	 | 
	number
	 | 
	可使用窗口宽度,单位px
	 | 
	| 
	 | 
	windowHeight
	 | 
	number
	 | 
	可使用窗口高度,单位px
	 | 
	| 
	 | 
	statusBarHeight
	 | 
	number
	 | 
	状态栏的高度,单位px
	 | 
	| 
	 | 
	safeArea
	 | 
	Object
	 | 
	在竖屏正方向下的安全区域
	 | 
	| 
	 | 
	
		
		
		
			| 
			 | 
			结构属性
			 | 
			类型
			 | 
			说明
			 | 
		 
		
		
		
			| 
			 | 
			left
			 | 
			number
			 | 
			安全区域左上角横坐标
			 | 
		 
		
			| 
			 | 
			right
			 | 
			number
			 | 
			安全区域右下角横坐标
			 | 
		 
		
			| 
			 | 
			top
			 | 
			number
			 | 
			安全区域左上角纵坐标
			 | 
		 
		
			| 
			 | 
			bottom
			 | 
			number
			 | 
			安全区域右下角纵坐标
			 | 
		 
		
			| 
			 | 
			width
			 | 
			number
			 | 
			安全区域的宽度,单位逻辑像素
			 | 
		 
		
			| 
			 | 
			height
			 | 
			number
			 | 
			安全区域的高度,单位逻辑像素
			 | 
		 
		
		 
	 | 
	| 
	 | 
	screenTop
	 | 
	number
	 | 
	窗口上边缘的y值
	 | 
示例代码
const windowInfo = wx.getWindowInfo()
console.log(windowInfo.pixelRatio)
console.log(windowInfo.screenWidth)
console.log(windowInfo.screenHeight)
console.log(windowInfo.windowWidth)
console.log(windowInfo.windowHeight)
console.log(windowInfo.statusBarHeight)
console.log(windowInfo.safeArea)
console.log(windowInfo.screenTop)