修复 iOS 底部黑边,改为动态同步视口高度

This commit is contained in:
JSR
2026-03-19 20:03:28 +08:00
parent c4c65861c9
commit e44d1b67b9
+17
View File
@@ -77,6 +77,23 @@ const patchConsole = () => {
}
patchConsole()
const syncAppViewportHeight = () => {
const rootStyle = document.documentElement.style
const applyHeight = () => {
const viewportHeight = window.visualViewport?.height ?? window.innerHeight
rootStyle.setProperty("--ss-app-height", `${Math.round(viewportHeight)}px`)
}
applyHeight()
window.addEventListener("resize", applyHeight)
window.addEventListener("orientationchange", applyHeight)
window.visualViewport?.addEventListener("resize", applyHeight)
window.visualViewport?.addEventListener("scroll", applyHeight)
}
syncAppViewportHeight()
const disableTouchZoom = () => {
let lastTouchEnd = 0