2016-03-31 09:40:55 +08:00
|
|
|
---
|
2017-01-13 17:11:26 +08:00
|
|
|
order: 2
|
2017-09-27 22:32:49 +08:00
|
|
|
title:
|
2016-05-22 11:03:07 +08:00
|
|
|
zh-CN: 卡片模式
|
|
|
|
en-US: Card
|
2016-03-31 09:40:55 +08:00
|
|
|
---
|
2015-11-11 00:15:12 +08:00
|
|
|
|
2016-05-22 11:03:07 +08:00
|
|
|
## zh-CN
|
|
|
|
|
2015-11-13 18:20:22 +08:00
|
|
|
用于嵌套在空间有限的容器中。
|
2015-11-11 00:15:12 +08:00
|
|
|
|
2016-05-22 11:03:07 +08:00
|
|
|
## en-US
|
|
|
|
|
|
|
|
Nested inside a container element for rendering in limited space.
|
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
```tsx
|
2015-11-11 00:15:12 +08:00
|
|
|
import { Calendar } from 'antd';
|
2022-05-21 23:04:51 +08:00
|
|
|
import type { Dayjs } from 'dayjs';
|
2022-07-04 22:09:54 +08:00
|
|
|
import type { CalendarMode } from 'antd/es/calendar/generateCalendar';
|
2022-05-21 22:14:15 +08:00
|
|
|
import React from 'react';
|
2022-05-19 09:46:26 +08:00
|
|
|
|
|
|
|
const App: React.FC = () => {
|
2022-05-21 23:04:51 +08:00
|
|
|
const onPanelChange = (value: Dayjs, mode: CalendarMode) => {
|
2022-05-19 09:46:26 +08:00
|
|
|
console.log(value.format('YYYY-MM-DD'), mode);
|
|
|
|
};
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className="site-calendar-demo-card">
|
|
|
|
<Calendar fullscreen={false} onPanelChange={onPanelChange} />
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default App;
|
2019-05-07 14:57:32 +08:00
|
|
|
```
|
2019-12-24 20:58:42 +08:00
|
|
|
|
|
|
|
```css
|
|
|
|
.site-calendar-demo-card {
|
|
|
|
width: 300px;
|
|
|
|
border: 1px solid #f0f0f0;
|
2022-08-19 10:10:51 +08:00
|
|
|
border-radius: 8px;
|
2019-12-24 20:58:42 +08:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
<style>
|
|
|
|
[data-theme="dark"] .site-calendar-demo-card {
|
|
|
|
border: 1px solid #303030;
|
|
|
|
}
|
|
|
|
</style>
|