feat: 本次提交更新内容如下

layout兼容问题
This commit is contained in:
2025-07-25 16:15:52 +08:00
parent b3a1137d8e
commit a243e66746
5 changed files with 67 additions and 8 deletions

View File

@@ -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 ? (

View File

@@ -2,6 +2,7 @@ import React from "react";
import { createRoot } from "react-dom/client";
import App from "./App";
import "./styles/global.scss";
import VConsole from "vconsole";
new VConsole();
const root = createRoot(document.getElementById("root")!);
root.render(<App />);

View File

@@ -48,7 +48,6 @@ const Detail: React.FC = () => {
</div>
}
footer={<MeauMobile />}
>
<div style={{ padding: 48, textAlign: "center" }}>
<Spin />