Add default width for showTime DatePicker

This commit is contained in:
afc163 2016-03-23 15:58:46 +08:00
parent 6d122fa5b1
commit 20211d448c
2 changed files with 9 additions and 2 deletions

View File

@ -14,6 +14,6 @@ function onChange(value) {
}
ReactDOM.render(
<DatePicker showTime format="yyyy-MM-dd HH:mm:ss" placeholder="请选择时间" onChange={onChange} style={{ width: 160 }} />
<DatePicker showTime format="yyyy-MM-dd HH:mm:ss" placeholder="请选择时间" onChange={onChange} />
, mountNode);
````

View File

@ -114,8 +114,15 @@ function createPicker(TheCalendar, defaultFormat) {
if (this.state.open) {
pickerClass += ' ant-calendar-picker-open';
}
// default width for showTime
const pickerStyle = {};
if (this.props.showTime) {
pickerStyle.width = 180;
}
return (
<span className={pickerClass} style={this.props.style}>
<span className={pickerClass} style={{ ...pickerStyle, ...this.props.style }}>
<DatePicker
transitionName={this.props.transitionName}
disabled={this.props.disabled}