diff --git a/docs/Examples/next/Detail.md b/docs/Examples/next/Detail.md
index e3137ba482a..505fe6ae06b 100644
--- a/docs/Examples/next/Detail.md
+++ b/docs/Examples/next/Detail.md
@@ -183,7 +183,14 @@ const App = () => {
>
手动触发校验
-
+ 值重置
+
diff --git a/packages/core/src/form.ts b/packages/core/src/form.ts
index 409d1d879e5..7f03654f8c7 100644
--- a/packages/core/src/form.ts
+++ b/packages/core/src/form.ts
@@ -416,12 +416,21 @@ export class Form {
each(this.fields, (field, name) => {
const value = this.getValue(name)
const initialValue = this.getInitialValue(name, field.path)
- if (isEmpty(value) && isEmpty(initialValue)) {
- return
+ if (noValidate) {
+ if (field.errors.length > 0) {
+ field.errors = []
+ field.dirty = true
+ }
+ if (field.effectErrors.length > 0) {
+ field.effectErrors = []
+ field.dirty = true
+ }
+ }
+ if (!isEmpty(value) || !isEmpty(initialValue)) {
+ field.updateState(state => {
+ state.value = forceClear ? undefined : initialValue
+ })
}
- field.updateState(state => {
- state.value = forceClear ? undefined : initialValue
- })
if (field.dirty) {
raf(() => {
if (this.destructed) {
diff --git a/packages/react/src/state/form.tsx b/packages/react/src/state/form.tsx
index eb11e9f51ed..0ff4e5e3540 100644
--- a/packages/react/src/state/form.tsx
+++ b/packages/react/src/state/form.tsx
@@ -254,8 +254,8 @@ export const StateForm = createHOC((options, Form) => {
return this.form.submit()
}
- public reset = (forceClear?: boolean) => {
- this.form.reset(forceClear)
+ public reset = (forceClear?: boolean, noValidate: boolean = false) => {
+ this.form.reset(forceClear, noValidate)
}
public validate = () => {