Skip to content

Commit

Permalink
fix(@uform/core): compat onFormSubmit (alibaba#462)
Browse files Browse the repository at this point in the history
* fix(@uform/core): fix sync value

* fix(@uform/core): compat old onFormSubmit
  • Loading branch information
janryWang authored Dec 5, 2019
1 parent 9e72dd6 commit 8dfe105
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion docs/Examples/next/Detail.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,9 @@ const App = () => {
<Field type="transfer" title="穿梭框" name="transfer" />
<Field type="rating" title="等级" name="rating" />
<FormButtonGroup offset={7} sticky>
<Submit />
<Button onClick={()=>{
actions.submit()
}}>提交</Button>
<Button
type="primary"
onClick={() => setState({ editable: !state.editable })}
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -803,6 +803,7 @@ export function createForm<FieldProps, VirtualFieldProps>(
return Promise.reject(validated.errors)
}
if (isFn(onSubmit)) {
heart.publish(LifeCycleTypes.ON_FORM_SUBMIT, state)
return Promise.resolve(
onSubmit(state.getState(state => clone(state.values)))
).then(payload => ({ validated, payload }))
Expand Down

0 comments on commit 8dfe105

Please sign in to comment.