refactor for code style

pull/4482/merge
afc163 8 years ago
parent 0780b64099
commit 0187384445

@ -195,6 +195,10 @@ export default class FormItem extends React.Component<FormItemProps, any> {
} }
isRequired() { isRequired() {
const { required } = this.props;
if (required !== undefined) {
return required;
}
if (this.context.form) { if (this.context.form) {
const meta = this.getMeta() || {}; const meta = this.getMeta() || {};
const validate = (meta.validate || []); const validate = (meta.validate || []);
@ -209,9 +213,7 @@ export default class FormItem extends React.Component<FormItemProps, any> {
renderLabel() { renderLabel() {
const props = this.props; const props = this.props;
const labelCol = props.labelCol; const labelCol = props.labelCol;
const required = props.required === undefined ? const required = this.isRequired();
this.isRequired() :
props.required;
const className = classNames({ const className = classNames({
[`${props.prefixCls}-item-required`]: required, [`${props.prefixCls}-item-required`]: required,

Loading…
Cancel
Save