ant-design/components/calendar/demo/custom-render.md
2016-04-01 10:08:19 +08:00

525 B

order title
1 自定义渲染

dateCellRendermonthCellRender 函数来自定义需要渲染的数据。

import { Calendar } from 'antd';

function dateCellRender(value) {
  return <div>自定义日数据 {value.getDayOfMonth()}</div>;
}

function monthCellRender(value) {
  return <div>自定义月数据 {value.getMonth()}</div>;
}

ReactDOM.render(
  <Calendar defaultValue={new Date('2010-10-10')}
    dateCellRender={dateCellRender} monthCellRender={monthCellRender} />
, mountNode);