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

45 lines
1.0 KiB
Markdown

# 基本
- order: 0
最简单的用法。
---
````jsx
import { Calendar } from 'antd';
function getDateData(value) {
let listData;
switch (value.getDayOfMonth()) {
case 8:
listData = [
{ type: 'warn', content: '这里是警告事项.' },
{ type: 'normal', content: '这里是普通事项.' }
]; break;
case 10:
listData = [
{ type: 'warn', content: '这里是警告事项.' },
{ type: 'normal', content: '这里是普通事项.' },
{ type: 'error', content: '这里是错误事项.' }
]; break;
case 15:
listData = [
{ type: 'warn', content: '这里是警告事项.' },
{ type: 'normal', content: '这里是普通事项.' },
{ type: 'error', content: '这里是错误事项.' },
{ type: 'error', content: '这里是错误事项.' }
]; break;
}
return listData;
}
ReactDOM.render(
9 years ago
<Calendar getDateData={getDateData} type="date" />
, document.getElementById('components-calendar-demo-basic'));
````