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