优化Page

master
LiuJiaNan 2025-12-26 13:50:59 +08:00
parent 45bcba0f77
commit 57f0801d6b
1 changed files with 25 additions and 20 deletions

View File

@ -32,24 +32,28 @@ function Page(props) {
const timer = setTimeout(() => { const timer = setTimeout(() => {
getPageWidth(); getPageWidth();
}, 0); }, 0);
if (isShowAllAction && isShowFooter) {
window.addEventListener("resize", getPageWidth); window.addEventListener("resize", getPageWidth);
}
return () => { return () => {
if (isShowAllAction && isShowFooter) {
window.removeEventListener("resize", getPageWidth); window.removeEventListener("resize", getPageWidth);
}
clearTimeout(timer); clearTimeout(timer);
}; };
}, []); }, [isShowAllAction, isShowFooter]);
return ( return (
<div className="page" id="page"> <div className="page" id="page">
{(isShowAllAction && isShowHeader) && <HeaderBack title={headerTitle} history={history} previous={headerPrevious} />} {(isShowAllAction && isShowHeader) && <HeaderBack title={headerTitle} history={history} previous={headerPrevious} />}
<div style={{ padding: contentPadding }}> <div style={{ padding: contentPadding }}>
{props.children} {props.children}
</div>
{ {
(isShowAllAction && isShowFooter) && ( (isShowAllAction && isShowFooter) && (
<> <>
<div style={{ height: "32px" }}></div> <div style={{ height: "52px" }}></div>
<div style={{ textAlign: "center", backgroundColor: "rgb(241, 241, 242)", padding: "10px 0", position: "fixed", bottom: "0", width: pageWidth, margin: "0px -44px" }}> <div style={{ textAlign: "center", backgroundColor: "rgb(241, 241, 242)", padding: "10px 0", position: "fixed", bottom: "0", width: pageWidth, margin: "0px -20px" }}>
{customActionButtons || ( {customActionButtons || (
<Space> <Space>
{extraActionButtons} {extraActionButtons}
@ -63,6 +67,7 @@ function Page(props) {
) )
} }
</div> </div>
</div>
); );
} }