feat: alipay navbar

This commit is contained in:
zzc
2026-02-11 15:50:55 +08:00
parent f4cc6ff83d
commit c86d0f7351
3 changed files with 29 additions and 17 deletions

View File

@@ -2,12 +2,21 @@ const SYSTEM = uni.getSystemInfoSync();
export const getStatusBarHeight = () => SYSTEM.statusBarHeight || 15;
export const getTitleBarHeight = () => {
// #ifdef MP-ALIPAY
return 44;
// #endif
if (uni.getMenuButtonBoundingClientRect) {
const { top, height } = uni.getMenuButtonBoundingClientRect();
return height + (top - getStatusBarHeight()) * 2;
} else {
return 40;
try {
const rect = uni.getMenuButtonBoundingClientRect();
if (rect && rect.top && rect.height) {
return rect.height + (rect.top - getStatusBarHeight()) * 2;
}
} catch (e) {
console.error(e);
}
}
return 44;
};
export const getBavBarHeight = () => getStatusBarHeight() + getTitleBarHeight();