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 (