2015-11-13 18:20:22 +08:00
|
|
|
# 卡片模式
|
2015-11-11 00:15:12 +08:00
|
|
|
|
2015-11-13 18:20:22 +08:00
|
|
|
- order: 0
|
2015-11-11 00:15:12 +08:00
|
|
|
|
2015-11-13 18:20:22 +08:00
|
|
|
用于嵌套在空间有限的容器中。
|
2015-11-11 00:15:12 +08:00
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
````jsx
|
|
|
|
import { Calendar } from 'antd';
|
|
|
|
|
|
|
|
function getDateData(value) {
|
2015-11-11 14:32:58 +08:00
|
|
|
let listData;
|
2015-11-11 00:15:12 +08:00
|
|
|
switch (value.getDayOfMonth()) {
|
|
|
|
case 8:
|
2015-11-11 14:32:58 +08:00
|
|
|
listData = [
|
2015-11-11 00:15:12 +08:00
|
|
|
{ type: 'warn', content: '这里是警告事项.' },
|
|
|
|
{ type: 'normal', content: '这里是普通事项.' }
|
2015-11-13 18:20:22 +08:00
|
|
|
];
|
|
|
|
break;
|
2015-11-11 00:15:12 +08:00
|
|
|
case 10:
|
2015-11-11 14:32:58 +08:00
|
|
|
listData = [
|
2015-11-11 00:15:12 +08:00
|
|
|
{ type: 'warn', content: '这里是警告事项.' },
|
|
|
|
{ type: 'normal', content: '这里是普通事项.' },
|
|
|
|
{ type: 'error', content: '这里是错误事项.' }
|
2015-11-13 18:20:22 +08:00
|
|
|
];
|
|
|
|
break;
|
2015-11-11 00:15:12 +08:00
|
|
|
case 15:
|
2015-11-11 14:32:58 +08:00
|
|
|
listData = [
|
2015-11-11 00:15:12 +08:00
|
|
|
{ type: 'warn', content: '这里是警告事项.' },
|
2015-11-13 18:20:22 +08:00
|
|
|
{ type: 'normal', content: '这里是普通事项.' },
|
2015-11-11 00:15:12 +08:00
|
|
|
{ type: 'error', content: '这里是错误事项.' },
|
|
|
|
{ type: 'error', content: '这里是错误事项.' }
|
2015-11-13 18:20:22 +08:00
|
|
|
];
|
|
|
|
break;
|
2015-11-11 00:15:12 +08:00
|
|
|
}
|
2015-11-11 14:32:58 +08:00
|
|
|
return listData;
|
2015-11-11 00:15:12 +08:00
|
|
|
}
|
2015-11-13 18:20:22 +08:00
|
|
|
|
|
|
|
function onChange(value) {
|
|
|
|
console.log('change');
|
2015-11-11 00:15:12 +08:00
|
|
|
}
|
|
|
|
|
2015-11-13 18:20:22 +08:00
|
|
|
function onTypeChange(type) {
|
|
|
|
console.log('Type change: %s.', type);
|
|
|
|
}
|
2015-11-11 00:15:12 +08:00
|
|
|
|
2015-11-13 18:20:22 +08:00
|
|
|
ReactDOM.render(
|
|
|
|
<div style={{ width: 290, border: '1px solid #d9d9d9', borderRadius: 4 }}>
|
|
|
|
<Calendar fullscreen={false} type="date" getDateData={getDateData} onChange={onChange} onTypeChange={onTypeChange} />
|
|
|
|
</div>
|
|
|
|
, document.getElementById('components-calendar-demo-card'));
|
|
|
|
````
|