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.
54 lines
1.3 KiB
Markdown
54 lines
1.3 KiB
Markdown
9 years ago
|
# 卡片模式
|
||
9 years ago
|
|
||
9 years ago
|
- order: 0
|
||
9 years ago
|
|
||
9 years ago
|
用于嵌套在空间有限的容器中。
|
||
9 years ago
|
|
||
|
---
|
||
|
|
||
|
````jsx
|
||
|
import { Calendar } from 'antd';
|
||
|
|
||
|
function getDateData(value) {
|
||
9 years ago
|
let listData;
|
||
9 years ago
|
switch (value.getDayOfMonth()) {
|
||
|
case 8:
|
||
9 years ago
|
listData = [
|
||
9 years ago
|
{ type: 'warn', content: '这里是警告事项.' },
|
||
|
{ type: 'normal', content: '这里是普通事项.' }
|
||
9 years ago
|
];
|
||
|
break;
|
||
9 years ago
|
case 10:
|
||
9 years ago
|
listData = [
|
||
9 years ago
|
{ type: 'warn', content: '这里是警告事项.' },
|
||
|
{ type: 'normal', content: '这里是普通事项.' },
|
||
|
{ type: 'error', content: '这里是错误事项.' }
|
||
9 years ago
|
];
|
||
|
break;
|
||
9 years ago
|
case 15:
|
||
9 years ago
|
listData = [
|
||
9 years ago
|
{ type: 'warn', content: '这里是警告事项.' },
|
||
9 years ago
|
{ type: 'normal', content: '这里是普通事项.' },
|
||
9 years ago
|
{ type: 'error', content: '这里是错误事项.' },
|
||
|
{ type: 'error', content: '这里是错误事项.' }
|
||
9 years ago
|
];
|
||
|
break;
|
||
9 years ago
|
}
|
||
9 years ago
|
return listData;
|
||
9 years ago
|
}
|
||
9 years ago
|
|
||
|
function onChange(value) {
|
||
|
console.log('change');
|
||
9 years ago
|
}
|
||
|
|
||
9 years ago
|
function onTypeChange(type) {
|
||
|
console.log('Type change: %s.', type);
|
||
|
}
|
||
9 years ago
|
|
||
9 years ago
|
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'));
|
||
|
````
|