From 57c2c1b3657f9b746183e6b78ff9e4edebdddadd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=97=E6=B3=95=E9=91=AB?= Date: Tue, 11 May 2021 20:30:46 +0800 Subject: [PATCH] fix Form.submit miss return values (#1382) --- packages/core/src/models/Form.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/core/src/models/Form.ts b/packages/core/src/models/Form.ts index fcc5ec78192..1d11b7d0057 100644 --- a/packages/core/src/models/Form.ts +++ b/packages/core/src/models/Form.ts @@ -636,11 +636,14 @@ export class Form { this.notify(LifeCycleTypes.ON_FORM_SUBMIT_VALIDATE_END) let results: any try { - if (isFn(onSubmit) && this.valid) { - results = await onSubmit(toJS(this.values)) - } else if (this.invalid) { + if (this.invalid) { throw this.errors } + if (isFn(onSubmit)) { + results = await onSubmit(toJS(this.values)) + } else { + results = toJS(this.values) + } this.notify(LifeCycleTypes.ON_FORM_SUBMIT_SUCCESS) } catch (e) { this.setSubmitting(false)