English
Get window information
| App | H5 | 微信小程序 | 支付宝小程序 | 抖音小程序 | 快手小程序 | QQ小程序 | 百度小程序 | 京东小程序 | 钉钉小程序 | 飞书小程序 | 元服务 |
|---|---|---|---|---|---|---|---|---|---|---|---|
√ (3.4.13+) | √ (3.4.13+) | √ (2.20.1+) | x | x | x | x | x | x | x | x | x |
| HarmonyOS |
|---|
| HBuilderX 4.23 |
Return parameter description
| Parameter Name | Type | Description | Platform Difference Description |
|---|---|---|---|
| pixelRatio | number | Device pixel ratio | |
| screenWidth | number | Screen width | |
| screenHeight | number | Screen Height | |
| windowWidth | number | Available window width | |
| windowHeight | number | 可使用窗口高度 | |
| windowTop | number | 可使用窗口的顶部位置 | |
| windowBottom | number | The bottom position of the available window | |
| statusBarHeight | number | The height of the mobile phone status bar | |
| screenTop | number | The y value of the top edge of the window | |
| safeArea | object | Safe area in the positive direction of vertical screen | |
| safeAreaInsets | object | Inset position of safe area in the positive direction of vertical screen |
Structure of safeArea
| parameter | type | description |
|---|---|---|
| left | Number | Abscissa of the upper left corner of the safe area |
| right | Number | Abscissa of the lower right corner of the safe area |
| top | Number | The vertical coordinate of the upper left corner of the safe area |
| bottom | Number | The vertical coordinate of the lower right corner of the safe area |
| width | Number | Width of the safe area, in logical pixels |
| height | Number | The height of the safe area, in logical pixels |
Structure of safeAreaInsets
| parameter | type | description |
|---|---|---|
| left | Number | Insert position on the left side of the safe area |
| right | Number | The right caret position of the safe area |
| top | Number | 安全区顶部插入位置 |
| bottom | Number | 安全区域底部插入位置 |
| 类型 | 描述 |
|---|---|
| GetWindowInfoResult | result |
|:-|:-|:-|:-|:-:|:-| |pixelRatio|number|是|-| | |screenWidth|number|是|-| | |screenHeight|number|是|-| | |windowWidth|number|是|-| | |windowHeight|number|是|-| | |statusBarHeight|number|是|-| | |windowTop|number|是|-| --window-top),单位为px| |windowBottom|number|是|-| --window-bottom),单位为px| |safeArea|SafeArea|是|-| | |safeAreaInsets|SafeAreaInsets|是|-| | |screenTop|number|是|-| | |cutoutArea|Array<CutoutRect>|否|-| | | |