mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-01 19:49:59 +08:00
Allow FormItem.help to be boolean
This commit is contained in:
parent
0f72c80e79
commit
8cd0a08946
@ -109,6 +109,7 @@ class FormItem extends React.Component {
|
||||
[`${prefixCls}-item`]: true,
|
||||
[`${prefixCls}-item-compact`]: this._isCompact(props.children),
|
||||
[`${prefixCls}-item-with-help`]: !!props.help,
|
||||
[`${props.className}`]: !!props.className,
|
||||
};
|
||||
|
||||
return (
|
||||
@ -128,7 +129,7 @@ FormItem.propTypes = {
|
||||
prefixCls: React.PropTypes.string,
|
||||
label: React.PropTypes.node,
|
||||
labelCol: React.PropTypes.object,
|
||||
help: React.PropTypes.node,
|
||||
help: React.PropTypes.oneOfType([React.PropTypes.node, React.PropTypes.bool]),
|
||||
validateStatus: React.PropTypes.oneOf(['', 'success', 'warning', 'error', 'validating']),
|
||||
hasFeedback: React.PropTypes.bool,
|
||||
wrapperCol: React.PropTypes.object,
|
||||
|
@ -73,6 +73,25 @@ ReactDOM.render(
|
||||
<Input defaultValue="无效选择" id="error" />
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
label="Datepicker:"
|
||||
labelCol={{span: 5}}
|
||||
help>
|
||||
<Col span="6">
|
||||
<FormItem validateStatus="error" help="请选择正确日期">
|
||||
<DatePicker />
|
||||
</FormItem>
|
||||
</Col>
|
||||
<Col span="1">
|
||||
<p className="ant-form-split">-</p>
|
||||
</Col>
|
||||
<Col span="6">
|
||||
<FormItem>
|
||||
<DatePicker />
|
||||
</FormItem>
|
||||
</Col>
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
label="Datepicker:"
|
||||
labelCol={{span: 5}}
|
||||
@ -88,26 +107,7 @@ ReactDOM.render(
|
||||
<DatePicker />
|
||||
</Col>
|
||||
<Col span="19" offset="5">
|
||||
<p className="ant-form-explain">请输入正确选项</p>
|
||||
</Col>
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
label="Datepicker:"
|
||||
labelCol={{span: 5}}>
|
||||
<Col span="6">
|
||||
<FormItem validateStatus="error">
|
||||
<DatePicker />
|
||||
<p className="ant-form-explain">请输入正确选项</p>
|
||||
</FormItem>
|
||||
</Col>
|
||||
<Col span="1">
|
||||
<p className="ant-form-split">-</p>
|
||||
</Col>
|
||||
<Col span="6">
|
||||
<FormItem>
|
||||
<DatePicker />
|
||||
</FormItem>
|
||||
<p className="ant-form-explain">请选择正确日期</p>
|
||||
</Col>
|
||||
</FormItem>
|
||||
</Form>
|
||||
|
Loading…
Reference in New Issue
Block a user