You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ant-design/components/calendar/demo/basic.md

53 lines
1.3 KiB
Markdown

# 基本
- order: 0
9 years ago
一个通用的日历面板,支持年/月切换。
---
````jsx
import { Calendar } from 'antd';
function getDateData(value) {
let listData;
switch (value.getDayOfMonth()) {
case 8:
listData = [
{ type: 'warn', content: '这里是警告事项.' },
{ type: 'normal', content: '这里是普通事项.' }
9 years ago
];
break;
case 10:
listData = [
{ type: 'warn', content: '这里是警告事项.' },
{ type: 'normal', content: '这里是普通事项.' },
{ type: 'error', content: '这里是错误事项.' }
9 years ago
];
break;
case 15:
listData = [
{ type: 'warn', content: '这里是警告事项.' },
9 years ago
{ type: 'normal', content: '这里是普通事项好长啊。。....' },
{ type: 'error', content: '这里是错误事项.' },
{ type: 'error', content: '这里是错误事项.' },
{ type: 'error', content: '这里是错误事项.' },
{ type: 'error', content: '这里是错误事项.' }
9 years ago
];
break;
}
return listData;
9 years ago
}
9 years ago
function getMonthData(value) {
if (value.getMonth() === 8) {
return 1394;
}
return 0;
9 years ago
}
ReactDOM.render(
9 years ago
<Calendar type="date" getDateData={getDateData} getMonthData={getMonthData} />
, document.getElementById('components-calendar-demo-basic'));
````