|
@@ -343,22 +343,33 @@ export default {
|
|
|
this.statusBarHeight = systemInfo.statusBarHeight || 0;
|
|
this.statusBarHeight = systemInfo.statusBarHeight || 0;
|
|
|
this.heroTopOffset = 0;
|
|
this.heroTopOffset = 0;
|
|
|
this.capsuleSafeRight = 0;
|
|
this.capsuleSafeRight = 0;
|
|
|
|
|
+ const topLift = uni.upx2px(10);
|
|
|
|
|
+ const liftTop = (px) => Math.max(this.statusBarHeight, px - topLift);
|
|
|
// #ifdef MP-WEIXIN
|
|
// #ifdef MP-WEIXIN
|
|
|
const menuButton = uni.getMenuButtonBoundingClientRect();
|
|
const menuButton = uni.getMenuButtonBoundingClientRect();
|
|
|
if (menuButton && menuButton.bottom) {
|
|
if (menuButton && menuButton.bottom) {
|
|
|
- this.heroTopOffset = menuButton.bottom + 12;
|
|
|
|
|
|
|
+ this.heroTopOffset = liftTop(menuButton.bottom + 12);
|
|
|
}
|
|
}
|
|
|
if (menuButton && menuButton.left) {
|
|
if (menuButton && menuButton.left) {
|
|
|
this.capsuleSafeRight = systemInfo.windowWidth - menuButton.left + 8;
|
|
this.capsuleSafeRight = systemInfo.windowWidth - menuButton.left + 8;
|
|
|
}
|
|
}
|
|
|
// #endif
|
|
// #endif
|
|
|
// #ifdef APP-PLUS
|
|
// #ifdef APP-PLUS
|
|
|
- const safeTop =
|
|
|
|
|
|
|
+ const statusBar = this.statusBarHeight;
|
|
|
|
|
+ const safeInsetTop =
|
|
|
(systemInfo.safeAreaInsets && systemInfo.safeAreaInsets.top) ||
|
|
(systemInfo.safeAreaInsets && systemInfo.safeAreaInsets.top) ||
|
|
|
(systemInfo.safeArea && systemInfo.safeArea.top) ||
|
|
(systemInfo.safeArea && systemInfo.safeArea.top) ||
|
|
|
- this.statusBarHeight;
|
|
|
|
|
- // 自定义导航:状态栏 + 标题栏区域,避免 App 端内容顶到状态栏下
|
|
|
|
|
- this.heroTopOffset = safeTop + 44 + 12;
|
|
|
|
|
|
|
+ 0;
|
|
|
|
|
+ const topInset = Math.max(statusBar, safeInsetTop);
|
|
|
|
|
+ const isIos =
|
|
|
|
|
+ systemInfo.platform === "ios" || (systemInfo.osName && systemInfo.osName.toLowerCase() === "ios");
|
|
|
|
|
+ if (isIos) {
|
|
|
|
|
+ // iOS 刘海屏 safeArea.top 已含状态栏,仅补内容与顶部的间距
|
|
|
|
|
+ this.heroTopOffset = liftTop(topInset + 12);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // Android 自定义导航:状态栏 + 约 44px 标题区(与微信胶囊下边距接近)
|
|
|
|
|
+ this.heroTopOffset = liftTop(topInset + 44 + 12);
|
|
|
|
|
+ }
|
|
|
// #endif
|
|
// #endif
|
|
|
} catch (e) {
|
|
} catch (e) {
|
|
|
this.statusBarHeight = 0;
|
|
this.statusBarHeight = 0;
|