From ed3309fcd1941b240fe84561b71bbdbb07253ea3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=B0=8F?= <736883394@qq.com> Date: Tue, 29 Apr 2025 16:41:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=96=B9=E6=B3=95=EF=BC=9A?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=AF=BC=E8=88=AA=E6=A0=8F=E9=AB=98=E5=BA=A6?= =?UTF-8?q?=E3=80=81=E5=B1=8F=E5=B9=95=E9=AB=98=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ebike-maintenance/utils/tools.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/ebike-maintenance/utils/tools.js b/ebike-maintenance/utils/tools.js index 679e59b..d01f1fd 100644 --- a/ebike-maintenance/utils/tools.js +++ b/ebike-maintenance/utils/tools.js @@ -115,4 +115,36 @@ export function isNullOrEmpty(value){ return true; else return false; +} + +//获取导航栏高度 +export function getNavHeight(callback) { + // 获取胶囊按钮信息 + const menuButtonInfo = uni.getMenuButtonBoundingClientRect(); + uni.getSystemInfo({ + success: (res) => { + const statusBarHeight = res.statusBarHeight; + const navHeight = + statusBarHeight + + menuButtonInfo.height + + (menuButtonInfo.top - statusBarHeight) * 2; + callback(navHeight); + } + }); + } + +export function getScreenHeightNoTabBar(callback){ + // 获取胶囊按钮信息 + const menuButtonInfo = uni.getMenuButtonBoundingClientRect(); + uni.getSystemInfo({ + success: (res) => { + const {statusBarHeight,windowHeight,screenHeight}=res; + const navHeight = + statusBarHeight + + menuButtonInfo.height + + (menuButtonInfo.top - statusBarHeight) * 2; + const height=screenHeight-navHeight; + callback(height); + } + }); } \ No newline at end of file