2025-07-18 12:03:13 +08:00
|
|
|
import React from "react";
|
2025-07-19 16:10:26 +08:00
|
|
|
import { SpinLoading } from "antd-mobile";
|
2025-07-18 12:03:13 +08:00
|
|
|
import styles from "./layout.module.scss";
|
2025-07-19 16:10:26 +08:00
|
|
|
|
2025-07-18 12:03:13 +08:00
|
|
|
interface LayoutProps {
|
|
|
|
|
loading?: boolean;
|
|
|
|
|
children?: React.ReactNode;
|
|
|
|
|
header?: React.ReactNode;
|
|
|
|
|
footer?: React.ReactNode;
|
|
|
|
|
}
|
|
|
|
|
|
2025-07-19 16:10:26 +08:00
|
|
|
const Layout: React.FC<LayoutProps> = ({
|
|
|
|
|
children,
|
|
|
|
|
header,
|
|
|
|
|
footer,
|
|
|
|
|
loading = false,
|
|
|
|
|
}) => {
|
2025-07-18 12:03:13 +08:00
|
|
|
return (
|
|
|
|
|
<div className={styles.container}>
|
|
|
|
|
{header && <header>{header}</header>}
|
2025-07-19 16:10:26 +08:00
|
|
|
<main>
|
|
|
|
|
{loading ? (
|
|
|
|
|
<div className={styles.loadingContainer}>
|
|
|
|
|
<SpinLoading color="primary" style={{ fontSize: 32 }} />
|
|
|
|
|
<div className={styles.loadingText}>加载中...</div>
|
|
|
|
|
</div>
|
|
|
|
|
) : (
|
|
|
|
|
children
|
|
|
|
|
)}
|
|
|
|
|
</main>
|
2025-07-18 12:03:13 +08:00
|
|
|
{footer && <footer>{footer}</footer>}
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default Layout;
|