mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 14:13:37 +08:00
fix calendar switch, close #753
This commit is contained in:
parent
4564324621
commit
74036396fe
@ -9,12 +9,12 @@
|
|||||||
````jsx
|
````jsx
|
||||||
import { Calendar } from 'antd';
|
import { Calendar } from 'antd';
|
||||||
|
|
||||||
function dateCellRender() {
|
function dateCellRender(value) {
|
||||||
return <div>自定义日数据</div>;
|
return <div>自定义日数据 {value.getDayOfMonth()}</div>;
|
||||||
}
|
}
|
||||||
|
|
||||||
function monthCellRender() {
|
function monthCellRender(value) {
|
||||||
return <div>自定义月数据</div>;
|
return <div>自定义月数据 {value.getMonth()}</div>;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReactDOM.render(
|
ReactDOM.render(
|
||||||
|
@ -68,14 +68,6 @@ class Calendar extends Component {
|
|||||||
this.props.onPanelChange(this.state.value, mode);
|
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() {
|
render() {
|
||||||
const props = this.props;
|
const props = this.props;
|
||||||
const {value, mode} = this.state;
|
const {value, mode} = this.state;
|
||||||
@ -104,7 +96,6 @@ class Calendar extends Component {
|
|||||||
type={type}
|
type={type}
|
||||||
prefixCls={prefixCls}
|
prefixCls={prefixCls}
|
||||||
showHeader={false}
|
showHeader={false}
|
||||||
onSelect={this.onPanelSelect.bind(this)}
|
|
||||||
value={value}
|
value={value}
|
||||||
monthCellRender={this.monthCellRender.bind(this)}
|
monthCellRender={this.monthCellRender.bind(this)}
|
||||||
dateCellRender={this.dateCellRender.bind(this)} />
|
dateCellRender={this.dateCellRender.bind(this)} />
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
"gregorian-calendar-format": "~4.0.4",
|
"gregorian-calendar-format": "~4.0.4",
|
||||||
"object-assign": "~4.0.1",
|
"object-assign": "~4.0.1",
|
||||||
"rc-animate": "~2.0.2",
|
"rc-animate": "~2.0.2",
|
||||||
"rc-calendar": "~5.1.0",
|
"rc-calendar": "~5.2.0",
|
||||||
"rc-checkbox": "~1.1.1",
|
"rc-checkbox": "~1.1.1",
|
||||||
"rc-collapse": "~1.4.4",
|
"rc-collapse": "~1.4.4",
|
||||||
"rc-dialog": "~5.2.2",
|
"rc-dialog": "~5.2.2",
|
||||||
|
Loading…
Reference in New Issue
Block a user