uniapp可视范围高度 - 用户屏幕可操作的屏幕高度 - 适用于APP、H5@公众号、纯H5@Chrome

可视范围高度

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

实测数据

bash 复制代码
============================
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
}
相关推荐
百思可瑞教育6 小时前
uni-app 根据用户不同身份显示不同的tabBar
vue.js·uni-app·北京百思可瑞教育·北京百思教育
Q_Q196328847512 小时前
python+springboot+uniapp微信小程序题库系统 在线答题 题目分类 错题本管理 学习记录查询系统
spring boot·python·django·uni-app·node.js·php
百思可瑞教育14 小时前
使用UniApp实现一个AI对话页面
javascript·vue.js·人工智能·uni-app·xcode·北京百思可瑞教育·百思可瑞教育
不想吃饭e15 小时前
在uniapp/vue项目中全局挂载component
前端·vue.js·uni-app
00后程序员张15 小时前
iOS App 混淆与资源保护:iOS配置文件加密、ipa文件安全、代码与多媒体资源防护全流程指南
android·安全·ios·小程序·uni-app·cocoa·iphone
不知名的前端专家20 小时前
uniapp原生插件 TCP Socket 使用文档
网络·tcp/ip·uni-app·netty
fakaifa21 小时前
【独立版】智创云享知识付费小程序 v5.0.23+小程序 搭建教程
小程序·uni-app·知识付费·源码下载·智创云享独立版
2501_9160074721 小时前
Transporter App 使用全流程详解:iOS 应用 ipa 上传工具、 uni-app 应用发布指南
android·ios·小程序·https·uni-app·iphone·webview
fakaifa1 天前
CRMEB多门店 v3.3源码 无授权限制+PC端+uniapp前端
小程序·uni-app·商城小程序·技术教程·源码下载·crmeb多门店
编程迪1 天前
小说阅读系统Java源码 小说阅读软件开发 小说app小程序
小程序·uni-app·小说源码·小说系统·小说阅读app