feat: 本次提交更新内容如下
layout兼容问题
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import React from "react";
|
||||
import React, { useEffect } from "react";
|
||||
import { SpinLoading } from "antd-mobile";
|
||||
import styles from "./layout.module.scss";
|
||||
|
||||
@@ -15,8 +15,24 @@ const Layout: React.FC<LayoutProps> = ({
|
||||
footer,
|
||||
loading = false,
|
||||
}) => {
|
||||
// 移动端100vh兼容
|
||||
useEffect(() => {
|
||||
const setRealHeight = () => {
|
||||
document.documentElement.style.setProperty(
|
||||
"--real-vh",
|
||||
`${window.innerHeight * 0.01}px`
|
||||
);
|
||||
};
|
||||
setRealHeight();
|
||||
window.addEventListener("resize", setRealHeight);
|
||||
return () => window.removeEventListener("resize", setRealHeight);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className={styles.container}>
|
||||
<div
|
||||
className={styles.container}
|
||||
style={{ height: "calc(var(--real-vh, 1vh) * 100)" }}
|
||||
>
|
||||
{header && <header>{header}</header>}
|
||||
<main>
|
||||
{loading ? (
|
||||
|
||||
Reference in New Issue
Block a user