Skip to main content

bn.getWindowInfo

getWindowInfo(): WindowInfo

description The api to get system window info

remark supported jssdk >= 4.0.0

example

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)

Returns

WindowInfo

WindowInfo


WindowInfo#

Ƭ WindowInfo: Object

Type declaration

NameTypeDescription
pixelRationumberdevice pixel ratio
screenWidthnumberScreen width, in px
screenHeightnumberScreen height, in px
windowWidthnumberAvailable window width, unit px
windowHeightnumberAvailable window height, in px
statusBarHeightnumberHeight of status bar in px
safeArea{ left: number ; right: number ; top: number ; bottom: number ; width: number ; height: number }A safe area in the positive direction of the vertical screen
safeArea.leftnumberUpper left abscissa of security area
safeArea.rightnumberSecurity area lower right abscissa
safeArea.topnumberTop-left ordinate of security area
safeArea.bottomnumberLower right ordinate of security area
safeArea.widthnumberWidth of security area, unit logical pixels
safeArea.heightnumberHeight of Safe Area, Unit Logical Pixels