Page和SeamlessScroll的children增加允许函数方式传入

master
LiuJiaNan 2026-02-25 15:20:15 +08:00
parent 7c93e8a2b7
commit 2b86f53e95
2 changed files with 4 additions and 3 deletions

View File

@ -18,6 +18,7 @@ function Page(props) {
contentPadding = "20px", contentPadding = "20px",
customActionButtons, customActionButtons,
extraActionButtons, extraActionButtons,
children
} = props; } = props;
const [pageWidth, setPageWidth] = useState(window.innerWidth); const [pageWidth, setPageWidth] = useState(window.innerWidth);
@ -49,7 +50,7 @@ function Page(props) {
<div className="page-layout" id="page-layout"> <div className="page-layout" id="page-layout">
{(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} {children && typeof children === "function" ? children() : children}
{ {
(isShowAllAction && isShowFooter) && ( (isShowAllAction && isShowFooter) && (
<div className="page-layout-footer" style={{ position: "relative", zIndex: "9" }}> <div className="page-layout-footer" style={{ position: "relative", zIndex: "9" }}>

View File

@ -442,12 +442,12 @@ const SeamlessScroll = forwardRef((props, ref) => {
return ( return (
<> <>
<div ref={slotListRef} style={floatStyle}> <div ref={slotListRef} style={floatStyle}>
{children} {children && typeof children === "function" ? children() : children}
</div> </div>
{isScroll {isScroll
? Array.from({ length: copyNum }).map((_, index) => ( ? Array.from({ length: copyNum }).map((_, index) => (
<div key={`copy-${index}`} style={floatStyle}> <div key={`copy-${index}`} style={floatStyle}>
{children} {children && typeof children === "function" ? children() : children}
</div> </div>
)) ))
: null} : null}