22 lines
595 B
JavaScript
22 lines
595 B
JavaScript
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() });
|
|
},
|
|
},
|
|
});
|