Respect mini program status bar and menu safe area
ci-cd / verify (push) Successful in 4s
ci-cd / deploy (push) Skipped

This commit is contained in:
2026-10-04 09:53:07 +08:00
parent 8a3036f0db
commit 46ac8f8a47
16 changed files with 54 additions and 10 deletions
+21
View File
@@ -0,0 +1,21 @@
function topHeight() {
const windowInfo = wx.getWindowInfo ? wx.getWindowInfo() : wx.getSystemInfoSync();
const statusHeight = windowInfo.statusBarHeight || 24;
let menuBottom = 0;
try {
const menu = wx.getMenuButtonBoundingClientRect();
menuBottom = menu && menu.bottom ? menu.bottom : 0;
} catch (_) {
// Some development environments do not expose the menu geometry.
}
return Math.ceil(Math.max(menuBottom, statusHeight + 44) + 12);
}
Component({
data: { height: 100 },
lifetimes: {
attached() {
this.setData({ height: topHeight() });
},
},
});