mirror of
https://github.com/SECTL/SecScore.git
synced 2026-07-19 21:14:21 +08:00
修复iOS端视口高度计算导致的底部黑边
This commit is contained in:
+3
-2
@@ -1,6 +1,7 @@
|
|||||||
@import "antd/dist/reset.css";
|
@import "antd/dist/reset.css";
|
||||||
|
|
||||||
:root {
|
:root {
|
||||||
|
--ss-app-height: 100dvh;
|
||||||
--ss-safe-area-top: env(safe-area-inset-top, 0px);
|
--ss-safe-area-top: env(safe-area-inset-top, 0px);
|
||||||
--ss-safe-area-right: env(safe-area-inset-right, 0px);
|
--ss-safe-area-right: env(safe-area-inset-right, 0px);
|
||||||
--ss-safe-area-bottom: env(safe-area-inset-bottom, 0px);
|
--ss-safe-area-bottom: env(safe-area-inset-bottom, 0px);
|
||||||
@@ -17,7 +18,7 @@ html,
|
|||||||
body,
|
body,
|
||||||
#root {
|
#root {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
min-height: 100dvh;
|
min-height: var(--ss-app-height);
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
@@ -32,7 +33,7 @@ body,
|
|||||||
position: fixed;
|
position: fixed;
|
||||||
inset: 0;
|
inset: 0;
|
||||||
width: 100vw;
|
width: 100vw;
|
||||||
height: 100dvh;
|
height: var(--ss-app-height);
|
||||||
padding-top: var(--ss-safe-area-top);
|
padding-top: var(--ss-safe-area-top);
|
||||||
padding-right: var(--ss-safe-area-right);
|
padding-right: var(--ss-safe-area-right);
|
||||||
padding-bottom: var(--ss-safe-area-bottom);
|
padding-bottom: var(--ss-safe-area-bottom);
|
||||||
|
|||||||
@@ -135,6 +135,15 @@ if (isMacDesktop) {
|
|||||||
document.documentElement.classList.add("platform-macos")
|
document.documentElement.classList.add("platform-macos")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const setAppHeightVar = () => {
|
||||||
|
const appHeight = Math.max(window.innerHeight, 0)
|
||||||
|
document.documentElement.style.setProperty("--ss-app-height", `${appHeight}px`)
|
||||||
|
}
|
||||||
|
setAppHeightVar()
|
||||||
|
window.addEventListener("resize", setAppHeightVar)
|
||||||
|
window.addEventListener("orientationchange", setAppHeightVar)
|
||||||
|
window.addEventListener("pageshow", setAppHeightVar)
|
||||||
|
|
||||||
window.addEventListener("error", (e: any) => {
|
window.addEventListener("error", (e: any) => {
|
||||||
const error = e?.error
|
const error = e?.error
|
||||||
safeWriteLog({
|
safeWriteLog({
|
||||||
|
|||||||
Reference in New Issue
Block a user