fix calendar switch, close #753

This commit is contained in:
afc163 2015-12-28 11:28:00 +08:00
parent 4564324621
commit 74036396fe
3 changed files with 5 additions and 14 deletions

View File

@ -9,12 +9,12 @@
````jsx
import { Calendar } from 'antd';
function dateCellRender() {
return <div>自定义日数据</div>;
function dateCellRender(value) {
return <div>自定义日数据 {value.getDayOfMonth()}</div>;
}
function monthCellRender() {
return <div>自定义月数据</div>;
function monthCellRender(value) {
return <div>自定义月数据 {value.getMonth()}</div>;
}
ReactDOM.render(

View File

@ -68,14 +68,6 @@ class Calendar extends Component {
this.props.onPanelChange(this.state.value, mode);
}
}
onPanelSelect(value, e) {
if (e && e.target === 'month') {
// Because the fullcalendars'type will automaticlly change to 'date' when select month cell
// but we didn't want this, so we force update view to get things right
// since ours 'mode' would not change.
this.forceUpdate();
}
}
render() {
const props = this.props;
const {value, mode} = this.state;
@ -104,7 +96,6 @@ class Calendar extends Component {
type={type}
prefixCls={prefixCls}
showHeader={false}
onSelect={this.onPanelSelect.bind(this)}
value={value}
monthCellRender={this.monthCellRender.bind(this)}
dateCellRender={this.dateCellRender.bind(this)} />

View File

@ -39,7 +39,7 @@
"gregorian-calendar-format": "~4.0.4",
"object-assign": "~4.0.1",
"rc-animate": "~2.0.2",
"rc-calendar": "~5.1.0",
"rc-calendar": "~5.2.0",
"rc-checkbox": "~1.1.1",
"rc-collapse": "~1.4.4",
"rc-dialog": "~5.2.2",