let _sysInfo = uni.getSystemInfoSync(); let statusBarHeight = 0; //状态栏高度 let titleBarHeight = 0; //导航栏高度 let customBarHeight = 0; //导航栏高度+导航栏高度 statusBarHeight = _sysInfo.statusBarHeight; // #ifndef MP if (_sysInfo.platform == 'android') { titleBarHeight = 50; } else { titleBarHeight = 45; } // #endif // #ifdef MP-WEIXIN let custom = wx.getMenuButtonBoundingClientRect(); // 导航栏高度(标题栏高度) = 胶囊高度 + (顶部距离 - 状态栏高度) * 2 titleBarHeight = custom.height + (custom.top - _sysInfo.statusBarHeight) * 2; // customBarHeight = custom.bottom + custom.top - statusBarHeight; // #endif // #ifdef MP-ALIPAY titleBarHeight = _sysInfo.titleBarHeight; // #endif customBarHeight = statusBarHeight + titleBarHeight; _sysInfo.titleBarHeight = titleBarHeight; _sysInfo.statusBarHeight = statusBarHeight; _sysInfo.customBarHeight = customBarHeight; export const sysInfo = _sysInfo;