mirror of
https://github.com/ant-design/ant-design.git
synced 2025-08-05 15:39:45 +08:00
Merge pull request #986 from ant-design/fix-formItem
fix: should not set required to label #985
This commit is contained in:
commit
c0154d3e47
@ -114,8 +114,13 @@ class FormItem extends React.Component {
|
|||||||
this.isRequired() :
|
this.isRequired() :
|
||||||
props.required;
|
props.required;
|
||||||
|
|
||||||
|
const className = classNames({
|
||||||
|
[this._getLayoutClass(labelCol)]: true,
|
||||||
|
[`${props.prefixCls}-item-required`]: required,
|
||||||
|
});
|
||||||
|
|
||||||
return props.label ? (
|
return props.label ? (
|
||||||
<label htmlFor={props.id || this.getId()} className={this._getLayoutClass(labelCol)} required={required} key="label">
|
<label htmlFor={props.id || this.getId()} className={className} key="label">
|
||||||
{props.label}
|
{props.label}
|
||||||
</label>
|
</label>
|
||||||
) : null;
|
) : null;
|
||||||
|
@ -36,7 +36,7 @@ let Demo = React.createClass({
|
|||||||
<FormItem
|
<FormItem
|
||||||
label="您的性别:"
|
label="您的性别:"
|
||||||
labelCol={{ span: 6 }}
|
labelCol={{ span: 6 }}
|
||||||
wrapperCol={{ span: 14 }}d>
|
wrapperCol={{ span: 14 }}>
|
||||||
<RadioGroup {...getFieldProps('gender', { initialValue: 'female' })}>
|
<RadioGroup {...getFieldProps('gender', { initialValue: 'female' })}>
|
||||||
<Radio value="male">男的</Radio>
|
<Radio value="male">男的</Radio>
|
||||||
<Radio value="female">女的</Radio>
|
<Radio value="female">女的</Radio>
|
||||||
|
@ -4,7 +4,14 @@
|
|||||||
|
|
||||||
label {
|
label {
|
||||||
position: relative;
|
position: relative;
|
||||||
&[required]:before {
|
|
||||||
|
> .@{iconfont-css-prefix} {
|
||||||
|
vertical-align: top;
|
||||||
|
font-size: @font-size-base;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.@{css-prefix}form-item-required:before {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin-right: 4px;
|
margin-right: 4px;
|
||||||
content: "*";
|
content: "*";
|
||||||
@ -13,12 +20,6 @@ label {
|
|||||||
color: @label-required-color;
|
color: @label-required-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
> .@{iconfont-css-prefix} {
|
|
||||||
vertical-align: top;
|
|
||||||
font-size: @font-size-base;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Input styles
|
// Input styles
|
||||||
.@{css-prefix}input {
|
.@{css-prefix}input {
|
||||||
.input;
|
.input;
|
||||||
|
Loading…
Reference in New Issue
Block a user