门店端优化
This commit is contained in:
@@ -29,6 +29,34 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function getSafeAreaHeight() {
|
||||
// 1. 优先使用 CSS 环境变量
|
||||
if (CSS.supports("padding-top", "env(safe-area-inset-top)")) {
|
||||
const safeAreaTop = getComputedStyle(
|
||||
document.documentElement,
|
||||
).getPropertyValue("env(safe-area-inset-top)");
|
||||
const height = parseInt(safeAreaTop) || 0;
|
||||
if (height > 0) return height;
|
||||
}
|
||||
|
||||
// 2. 设备检测
|
||||
const isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent);
|
||||
const isAndroid = /Android/.test(navigator.userAgent);
|
||||
const isAppMode = getSetting("isAppMode");
|
||||
if (isIOS && isAppMode) {
|
||||
// iOS 设备
|
||||
const isIPhoneX = window.screen.height >= 812;
|
||||
return isIPhoneX ? 44 : 20;
|
||||
} else if (isAndroid) {
|
||||
// Android 设备
|
||||
return 24;
|
||||
}
|
||||
|
||||
// 3. 默认值
|
||||
return 0;
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
@@ -45,10 +73,10 @@
|
||||
}
|
||||
|
||||
/* 安全区适配 */
|
||||
.safe-area-inset-bottom {
|
||||
padding-bottom: constant(safe-area-inset-bottom);
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
}
|
||||
// .safe-area-inset-bottom {
|
||||
// padding-bottom: constant(safe-area-inset-bottom);
|
||||
// padding-bottom: env(safe-area-inset-bottom);
|
||||
// }
|
||||
|
||||
/* 字体图标支持 */
|
||||
@font-face {
|
||||
|
||||
Reference in New Issue
Block a user