提交 ad721111 编写于 作者: O Open Next 提交者: Wei Zhu

fix bug in getting-started - date is null when clear the DatePick (#10111)

上级 ee4f788a
......@@ -79,7 +79,7 @@ class App extends React.Component {
};
}
handleChange(date) {
message.info('Selected Date: ' + date.toString());
message.info('Selected Date: ' + (date ? date.toString() : ''));
this.setState({ date });
}
render() {
......@@ -87,7 +87,7 @@ class App extends React.Component {
<LocaleProvider locale={frFR}>
<div style={{ width: 400, margin: '100px auto' }}>
<DatePicker onChange={value => this.handleChange(value)} />
<div style={{ marginTop: 20 }}>Date: {this.state.date.toString()}</div>
<div style={{ marginTop: 20 }}>Date: {this.state.date && this.state.date.toString()}</div>
</div>
</LocaleProvider>
);
......
......@@ -81,7 +81,7 @@ class App extends React.Component {
};
}
handleChange(date) {
message.info('您选择的日期是: ' + date.toString());
message.info('您选择的日期是: ' + (date ? date.toString() : ''));
this.setState({ date });
}
render() {
......@@ -89,7 +89,7 @@ class App extends React.Component {
<LocaleProvider locale={zhCN}>
<div style={{ width: 400, margin: '100px auto' }}>
<DatePicker onChange={value => this.handleChange(value)} />
<div style={{ marginTop: 20 }}>当前日期:{this.state.date.toString()}</div>
<div style={{ marginTop: 20 }}>当前日期:{this.state.date && this.state.date.toString()}</div>
</div>
</LocaleProvider>
);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册