行业知识
uniapp可视范围高度 - 用户屏幕可操作的屏幕高度 - 适用于APP、H5@公众号、纯H5@Chrome
2026-12-01 12:17:43
来源:互联网转载
可视范围高度
let heightPx = uni.getWindowInfo().windowHeight + uni.getWindowInfo().windowTop
官方手册
uni.getWindowInfo() | uni-app官网uni-app,uniCloud,serverless,uni.getWindowInfo()https://uniapp.dcloud.net.cn/api/system/getWindowInfo.html
实测数据
============================uni.getWindowInfo() >> APP-安卓真机实测============================{ "pixelRatio": 3, "screenWidth": 360, "screenHeight": 640, "windowWidth": 360, "windowHeight": 640, "statusBarHeight": 24, "safeArea": { "left": 0, "right": 360, "top": 24, "bottom": 640, "width": 360, "height": 616 }, "safeAreaInsets": { "top": 24, "right": 0, "bottom": 0, "left": 0 }, "windowTop": 0, "windowBottom": 0, "screenTop": 0}============================uni.getWindowInfo() >> 纯H5 - 非公众号============================{ "windowTop": 44, "windowBottom": 0, "windowWidth": 390, "windowHeight": 800, "pixelRatio": 3.0000001192092896, "screenWidth": 390, "screenHeight": 844, "statusBarHeight": 0, "safeArea": { "left": 0, "right": 390, "top": 0, "bottom": 844, "width": 390, "height": 844 }, "safeAreaInsets": { "top": 0, "right": 0, "bottom": 0, "left": 0 }, "screenTop": 44}============================uni.getWindowInfo() >> H5公众号 - 苹果机iPhone13Pro============================{ "windowTop": 44, "windowBottom": 0, "windowWidth": 390, "windowHeight": 710, "pixelRatio": 3.0000001192092896, "screenWidth": 390, "screenHeight": 753, "statusBarHeight": 0, "safeArea": { "left": 0, "right": 390, "top": 0, "bottom": 720, "width": 390, "height": 720 }, "safeAreaInsets": { "top": 0, "right": 0, "bottom": 34, "left": 0 }, "screenTop": 43}============================uni.getWindowInfo() >> H5公众号 - 安卓机Nexus 6============================{ "windowTop": 44, "windowBottom": 0, "windowWidth": 412, "windowHeight": 620, "pixelRatio": 3.0000001192092896, "screenWidth": 412, "screenHeight": 664, "statusBarHeight": 0, "safeArea": { "left": 0, "right": 412, "top": 0, "bottom": 664, "width": 412, "height": 664 }, "safeAreaInsets": { "top": 0, "right": 0, "bottom": 0, "left": 0 }, "screenTop": 44}
上一篇:服务器的文件删除怎么恢复?
下一篇:云免服务器怎么用?