Skip to content

Commit

Permalink
fix form select field 'destroyOnUnmount' (#1302)
Browse files Browse the repository at this point in the history
  • Loading branch information
intellild authored Dec 19, 2019
1 parent 75a6975 commit b9f4120
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/zent/src/form/form-components/SelectField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export const FormSelectField: React.FunctionComponent<IFormSelectFieldProps<
const {
name,
defaultValue,
destroyOnUnmount,
} = (props as unknown) as IFormFieldViewDrivenProps<any>;
let validators =
((props as unknown) as IFormFieldViewDrivenProps<any>).validators || [];
Expand All @@ -55,6 +56,7 @@ export const FormSelectField: React.FunctionComponent<IFormSelectFieldProps<
] as IValidators<any>).concat(validators);
}
model = useField<any>(name, defaultValue, validators);
model.destroyOnUnmount = Boolean(destroyOnUnmount);
} else {
model = useField<any>(
((props as unknown) as IFormFieldModelDrivenProps<any>).model
Expand Down

0 comments on commit b9f4120

Please sign in to comment.