ant-design/components/calendar/demo/custom-render.md

25 lines
497 B
Markdown
Raw Normal View History

2015-11-13 19:19:08 +08:00
# 自定义渲染
- order: 2
`dateCellRender``monthCellRender` 函数来自定义需要渲染的数据。
---
````jsx
import { Calendar } from 'antd';
function dateCellRender(value) {
2015-11-13 19:56:34 +08:00
return <div>date</div>;
2015-11-13 19:19:08 +08:00
}
function monthCellRender(value) {
2015-11-13 19:56:34 +08:00
return <div>month</div>;
2015-11-13 19:19:08 +08:00
}
ReactDOM.render(
2015-11-13 20:32:54 +08:00
<Calendar value={new Date('2010-10-10')}
dateCellRender={dateCellRender} monthCellRender={monthCellRender} />
2015-11-13 19:19:08 +08:00
, document.getElementById('components-calendar-demo-custom-render'));
````