2015-11-13 19:19:08 +08:00
|
|
|
# 自定义渲染
|
|
|
|
|
2015-11-13 22:34:49 +08:00
|
|
|
- order: 1
|
2015-11-13 19:19:08 +08:00
|
|
|
|
|
|
|
用 `dateCellRender` 和 `monthCellRender` 函数来自定义需要渲染的数据。
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
````jsx
|
|
|
|
import { Calendar } from 'antd';
|
|
|
|
|
2015-12-28 11:28:00 +08:00
|
|
|
function dateCellRender(value) {
|
|
|
|
return <div>自定义日数据 {value.getDayOfMonth()}</div>;
|
2015-11-13 19:19:08 +08:00
|
|
|
}
|
|
|
|
|
2015-12-28 11:28:00 +08:00
|
|
|
function monthCellRender(value) {
|
|
|
|
return <div>自定义月数据 {value.getMonth()}</div>;
|
2015-11-13 19:19:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
ReactDOM.render(
|
2015-11-15 21:40:01 +08:00
|
|
|
<Calendar defaultValue={new Date('2010-10-10')}
|
2016-01-08 14:41:05 +08:00
|
|
|
dateCellRender={dateCellRender} monthCellRender={monthCellRender} />
|
2015-12-29 12:08:58 +08:00
|
|
|
, mountNode);
|
2015-11-13 19:19:08 +08:00
|
|
|
````
|