fix scroll value and record viewport when loaded

This commit is contained in:
Yanzhen Yu
2026-04-01 12:00:00 +08:00
parent 41b9861fbf
commit 4446e27899
4 changed files with 41 additions and 16 deletions

View File

@@ -79,3 +79,19 @@ export function hookSetter<T>(
});
return () => hookSetter(target, key, original || {});
}
export function getWindowHeight(): number {
return (
window.innerHeight ||
(document.documentElement && document.documentElement.clientHeight) ||
(document.body && document.body.clientHeight)
);
}
export function getWindowWidth(): number {
return (
window.innerWidth ||
(document.documentElement && document.documentElement.clientWidth) ||
(document.body && document.body.clientWidth)
);
}