mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-21 13:18:04 +08:00
9053192ae9
* fix components style * fix snapshot * update travis node version * change upload action in ci
1.1 KiB
1.1 KiB
order | title | ||||
---|---|---|---|---|---|
12 |
|
zh-CN
使用 dateRender
可以自定义日期单元格的内容和样式。
en-US
We can customize the rendering of date cells in the calendar by providing a dateRender
function to DatePicker
.
import { DatePicker } from 'antd';
const { RangePicker } = DatePicker;
ReactDOM.render(
<div>
<DatePicker
dateRender={(current) => {
const style = {};
if (current.date() === 1) {
style.border = '1px solid #1890ff';
style.borderRadius = '50%';
}
return (
<div className="ant-calendar-date" style={style}>
{current.date()}
</div>
);
}}
/>
<RangePicker
dateRender={(current) => {
const style = {};
if (current.date() === 1) {
style.border = '1px solid #1890ff';
style.borderRadius = '50%';
}
return (
<div className="ant-calendar-date" style={style}>
{current.date()}
</div>
);
}}
/>
</div>
, mountNode);