mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-29 18:48:45 +08:00
feat: form 的自动提交支持设置 close 来避免关闭弹框 (#7555)
This commit is contained in:
parent
a9bc93e3e6
commit
c9fd4e3766
@ -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` 来自定义配置,则以配置的为准。
|
||||
|
@ -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
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user