diff --git a/docs/zh-CN/components/drawer.md b/docs/zh-CN/components/drawer.md index 2aa1f41a9..8fb308413 100755 --- a/docs/zh-CN/components/drawer.md +++ b/docs/zh-CN/components/drawer.md @@ -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` 来自定义配置,则以配置的为准。 diff --git a/packages/amis-core/src/renderers/Form.tsx b/packages/amis-core/src/renderers/Form.tsx index d64b6ed95..33ac367f3 100644 --- a/packages/amis-core/src/renderers/Form.tsx +++ b/packages/amis-core/src/renderers/Form.tsx @@ -1019,7 +1019,7 @@ export default class Form extends React.Component { } handleFormSubmit(e: React.UIEvent) { - 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 { const sensor: any = this.handleAction( e, { - type: 'submit' + type: 'submit', + close }, this.props.store.data );