不应该设置默认值

This commit is contained in:
afc163 2015-05-29 21:28:01 +08:00
parent b0d5b31e11
commit bb486a6a60
3 changed files with 4 additions and 7 deletions

View File

@ -9,6 +9,6 @@
var Datepicker = antd.datepicker; var Datepicker = antd.datepicker;
React.render( React.render(
<Datepicker value="2015-01-01" /> <Datepicker value="" />
, document.getElementById('components-datepicker-demo-basic')); , document.getElementById('components-datepicker-demo-basic'));
```` ````

View File

@ -9,6 +9,6 @@
var Datepicker = antd.datepicker; var Datepicker = antd.datepicker;
React.render( React.render(
<Datepicker format="yyyy/MM/dd" /> <Datepicker value="2015/01/01" format="yyyy/MM/dd" />
, document.getElementById('components-datepicker-demo-formatter')); , document.getElementById('components-datepicker-demo-formatter'));
```` ````

View File

@ -9,10 +9,8 @@ var DateTimeFormat = require('gregorian-calendar-format');
module.exports = React.createClass({ module.exports = React.createClass({
getInitialState: function () { getInitialState: function () {
var value = new GregorianCalendar(zhCn);
value.setTime(Date.now());
return { return {
value: value value: ''
}; };
}, },
getDefaultProps: function () { getDefaultProps: function () {
@ -35,7 +33,6 @@ module.exports = React.createClass({
this.props.onSelect(new Date(this.state.value.getTime())); this.props.onSelect(new Date(this.state.value.getTime()));
}, },
render: function () { render: function () {
console.log(this.props.showTime);
var calendar = ( var calendar = (
<Calendar <Calendar
disabledDate={this.state.disabled} disabledDate={this.state.disabled}
@ -51,7 +48,7 @@ module.exports = React.createClass({
formatter={new DateTimeFormat(this.props.format)} formatter={new DateTimeFormat(this.props.format)}
value={this.state.value} value={this.state.value}
onChange={this.props.onSelect}> onChange={this.props.onSelect}>
<input className="rc-calendar-picker-input" /> <input placeholder="请选择日期" className="rc-calendar-picker-input" />
</DatePicker> </DatePicker>
); );
} }