feat: form 的自动提交支持设置 close 来避免关闭弹框 (#7555)

This commit is contained in:
吴多益 2023-07-25 19:20:25 +08:00 committed by GitHub
parent a9bc93e3e6
commit c9fd4e3766
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 2 deletions

View File

@ -400,6 +400,30 @@ order: 43
}
```
> 3.3.0 及以上版本
如果是表单,可以在表单上配置 `close: false`
```schema: scope="body"
{
"type": "button",
"label": "弹个框",
"actionType": "drawer",
"drawer": {
"type": "form",
"api": "/api/mock2/form/saveForm",
"body": [
{
"type": "input-text",
"name": "name",
"label": "姓名"
}
],
"close": false
}
}
```
## 配置弹窗的按钮
默认弹窗会自动生成两个按钮,一个取消,一个确认。如果通过 `actions` 来自定义配置,则以配置的为准。

View File

@ -1019,7 +1019,7 @@ export default class Form extends React.Component<FormProps, object> {
}
handleFormSubmit(e: React.UIEvent<any>) {
const {preventEnterSubmit, onActionSensor} = this.props;
const {preventEnterSubmit, onActionSensor, close} = this.props;
e.preventDefault();
if (preventEnterSubmit) {
@ -1029,7 +1029,8 @@ export default class Form extends React.Component<FormProps, object> {
const sensor: any = this.handleAction(
e,
{
type: 'submit'
type: 'submit',
close
},
this.props.store.data
);