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

View File

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