优化FormBuilder

master
LiuJiaNan 2025-11-08 08:50:36 +08:00
parent ba6d7e524e
commit 12bd18debe
2 changed files with 44 additions and 39 deletions

View File

@ -31,6 +31,8 @@ export interface FormBuilderProps extends FormProps {
customActionButtons?: ReactNode; customActionButtons?: ReactNode;
/** 额外操作按钮组 */ /** 额外操作按钮组 */
extraActionButtons?: ReactNode; extraActionButtons?: ReactNode;
/** 是否处于加载状态,默认 false */
loading?: boolean;
} }
/** /**

View File

@ -1,4 +1,4 @@
import { Button, Col, Form, Row, Space } from "antd"; import { Button, Col, Form, Row, Space, Spin } from "antd";
import FormItemsRenderer from "./FormItemsRenderer"; import FormItemsRenderer from "./FormItemsRenderer";
/** /**
@ -19,6 +19,7 @@ const FormBuilder = (props) => {
showCancelButton = true, showCancelButton = true,
customActionButtons, customActionButtons,
extraActionButtons, extraActionButtons,
loading = false,
...restProps ...restProps
} = props; } = props;
@ -27,6 +28,7 @@ const FormBuilder = (props) => {
}; };
return ( return (
<Spin spinning={loading}>
<Form <Form
labelCol={labelCol} labelCol={labelCol}
scrollToFirstError scrollToFirstError
@ -66,6 +68,7 @@ const FormBuilder = (props) => {
</Row> </Row>
)} )}
</Form> </Form>
</Spin>
); );
}; };