From 57f0801d6b897bef9694401ea033407c1005ace3 Mon Sep 17 00:00:00 2001 From: LiuJiaNan <15703339975@163.com> Date: Fri, 26 Dec 2025 13:50:59 +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 | 45 ++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/src/components/Page/index.js b/src/components/Page/index.js index 2e38a62..05a7a0b 100644 --- a/src/components/Page/index.js +++ b/src/components/Page/index.js @@ -32,36 +32,41 @@ function Page(props) { const timer = setTimeout(() => { getPageWidth(); }, 0); - window.addEventListener("resize", getPageWidth); + if (isShowAllAction && isShowFooter) { + window.addEventListener("resize", getPageWidth); + } + return () => { - window.removeEventListener("resize", getPageWidth); + if (isShowAllAction && isShowFooter) { + window.removeEventListener("resize", getPageWidth); + } clearTimeout(timer); }; - }, []); + }, [isShowAllAction, isShowFooter]); return (
{(isShowAllAction && isShowHeader) && }
{props.children} + { + (isShowAllAction && isShowFooter) && ( + <> +
+
+ {customActionButtons || ( + + {extraActionButtons} + + + )} +
+ + ) + }
- { - (isShowAllAction && isShowFooter) && ( - <> -
-
- {customActionButtons || ( - - {extraActionButtons} - - - )} -
- - ) - }
); }