mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-25 03:29:59 +08:00
fix: empty string should be treat as inexisting, close: #3613
This commit is contained in:
parent
b240494dd5
commit
d57827f87c
@ -147,15 +147,18 @@ export default class FormItem extends React.Component<FormItemProps, any> {
|
|||||||
|
|
||||||
getValidateStatus() {
|
getValidateStatus() {
|
||||||
const { isFieldValidating, getFieldError, getFieldValue } = this.context.form;
|
const { isFieldValidating, getFieldError, getFieldValue } = this.context.form;
|
||||||
const field = this.getId();
|
const fieldId = this.getId();
|
||||||
if (!field) {
|
if (!fieldId) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
if (isFieldValidating(field)) {
|
if (isFieldValidating(fieldId)) {
|
||||||
return 'validating';
|
return 'validating';
|
||||||
} else if (!!getFieldError(field)) {
|
}
|
||||||
|
if (!!getFieldError(fieldId)) {
|
||||||
return 'error';
|
return 'error';
|
||||||
} else if (getFieldValue(field) !== undefined && getFieldValue(field) !== null) {
|
}
|
||||||
|
const fieldValue = getFieldValue(fieldId);
|
||||||
|
if (fieldValue !== undefined && fieldValue !== null && fieldValue !== '') {
|
||||||
return 'success';
|
return 'success';
|
||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
|
Loading…
Reference in New Issue
Block a user