From 474a95dcb2a28aa67d4d6cbffe79cf054fc3c65e Mon Sep 17 00:00:00 2001 From: LiuJiaNan <15703339975@163.com> Date: Sat, 27 Dec 2025 09:52:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96Page?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Page/index.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/components/Page/index.js b/src/components/Page/index.js index 05a7a0b..eae666d 100644 --- a/src/components/Page/index.js +++ b/src/components/Page/index.js @@ -1,5 +1,6 @@ import { Button, Space } from "antd"; import { useEffect, useState } from "react"; +import { throttle } from "throttle-debounce"; import HeaderBack from "../HeaderBack"; /** @@ -21,12 +22,12 @@ function Page(props) { const [pageWidth, setPageWidth] = useState(window.innerWidth); - const getPageWidth = () => { - const pageDom = document.querySelector("#page"); + const getPageWidth = throttle(50, () => { + const pageDom = document.querySelector("#page-layout"); if (!pageDom) return; setPageWidth(pageDom.offsetWidth); - }; + }); useEffect(() => { const timer = setTimeout(() => { @@ -45,13 +46,13 @@ function Page(props) { }, [isShowAllAction, isShowFooter]); return ( -
+
{(isShowAllAction && isShowHeader) && }
{props.children} { (isShowAllAction && isShowFooter) && ( - <> +
{customActionButtons || ( @@ -63,7 +64,7 @@ function Page(props) { )}
- +
) }