2016-03-31 14:17:09 +08:00
|
|
|
|
---
|
|
|
|
|
category: Components
|
2022-11-09 12:28:04 +08:00
|
|
|
|
group: 数据展示
|
2016-05-26 17:46:55 +08:00
|
|
|
|
title: Card
|
|
|
|
|
subtitle: 卡片
|
2022-11-30 20:14:41 +08:00
|
|
|
|
cover: https://mdn.alipayobjects.com/huamei_7uahnr/afts/img/A*VXtCTp93KPAAAAAAAAAAAAAADrJ8AQ/original
|
2023-02-09 22:17:31 +08:00
|
|
|
|
coverDark: https://mdn.alipayobjects.com/huamei_7uahnr/afts/img/A*a-8zR6rrupgAAAAAAAAAAAAADrJ8AQ/original
|
2016-03-31 14:17:09 +08:00
|
|
|
|
---
|
2016-02-19 19:35:49 +08:00
|
|
|
|
|
|
|
|
|
通用卡片容器。
|
|
|
|
|
|
|
|
|
|
## 何时使用
|
|
|
|
|
|
|
|
|
|
最基础的卡片容器,可承载文字、列表、图片、段落,常用于后台概览页面。
|
|
|
|
|
|
2022-11-09 12:28:04 +08:00
|
|
|
|
## 代码演示
|
|
|
|
|
|
2022-11-17 17:31:26 +08:00
|
|
|
|
<!-- prettier-ignore -->
|
2022-11-09 12:28:04 +08:00
|
|
|
|
<code src="./demo/basic.tsx">典型卡片</code>
|
2023-01-05 15:30:59 +08:00
|
|
|
|
<code src="./demo/border-less.tsx" background="grey">无边框</code>
|
2022-11-09 12:28:04 +08:00
|
|
|
|
<code src="./demo/simple.tsx">简洁卡片</code>
|
|
|
|
|
<code src="./demo/flexible-content.tsx">更灵活的内容展示</code>
|
2023-01-05 15:30:59 +08:00
|
|
|
|
<code src="./demo/in-column.tsx" background="grey">栅格卡片</code>
|
2022-11-09 12:28:04 +08:00
|
|
|
|
<code src="./demo/loading.tsx">预加载的卡片</code>
|
|
|
|
|
<code src="./demo/grid-card.tsx">网格型内嵌卡片</code>
|
|
|
|
|
<code src="./demo/inner.tsx">内部卡片</code>
|
|
|
|
|
<code src="./demo/tabs.tsx">带页签的卡片</code>
|
|
|
|
|
<code src="./demo/meta.tsx">支持更多内容配置</code>
|
2023-06-01 15:16:58 +08:00
|
|
|
|
<code src="./demo/component-token.tsx" debug>组件 Token</code>
|
2022-11-09 12:28:04 +08:00
|
|
|
|
|
2016-02-20 16:40:18 +08:00
|
|
|
|
## API
|
|
|
|
|
|
2023-08-08 18:27:48 +08:00
|
|
|
|
通用属性参考:[通用属性](/docs/react/common-props)
|
|
|
|
|
|
2019-12-26 14:37:39 +08:00
|
|
|
|
```jsx
|
2016-02-19 19:35:49 +08:00
|
|
|
|
<Card title="卡片标题">卡片内容</Card>
|
|
|
|
|
```
|
|
|
|
|
|
2017-07-07 13:36:54 +08:00
|
|
|
|
### Card
|
|
|
|
|
|
2019-07-11 14:14:33 +08:00
|
|
|
|
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|
|
|
|
|
| --- | --- | --- | --- | --- |
|
|
|
|
|
| actions | 卡片操作组,位置在卡片底部 | Array<ReactNode> | - | |
|
2019-11-20 20:31:43 +08:00
|
|
|
|
| activeTabKey | 当前激活页签的 key | string | - | |
|
2020-04-28 14:09:54 +08:00
|
|
|
|
| bodyStyle | 内容区域自定义样式 | CSSProperties | - | |
|
2019-07-11 14:14:33 +08:00
|
|
|
|
| bordered | 是否有边框 | boolean | true | |
|
|
|
|
|
| cover | 卡片封面 | ReactNode | - | |
|
2020-06-17 23:18:14 +08:00
|
|
|
|
| defaultActiveTabKey | 初始化选中页签的 key,如果没有设置 activeTabKey | string | `第一个页签` | |
|
2020-10-09 10:08:52 +08:00
|
|
|
|
| extra | 卡片右上角的操作区域 | ReactNode | - | |
|
2020-10-21 10:33:43 +08:00
|
|
|
|
| headStyle | 自定义标题区域样式 | CSSProperties | - | |
|
2019-07-11 14:14:33 +08:00
|
|
|
|
| hoverable | 鼠标移过时可浮起 | boolean | false | |
|
|
|
|
|
| loading | 当卡片内容还在加载中时,可以用 loading 展示一个占位 | boolean | false | |
|
2019-11-20 20:31:43 +08:00
|
|
|
|
| size | card 的尺寸 | `default` \| `small` | `default` | |
|
2020-10-21 10:33:43 +08:00
|
|
|
|
| tabBarExtraContent | tab bar 上额外的元素 | ReactNode | - | |
|
2023-05-16 22:24:41 +08:00
|
|
|
|
| tabList | 页签标题列表 | [TabItemType](/components/tabs#tabitemtype)[] | - | |
|
2022-12-22 14:12:26 +08:00
|
|
|
|
| tabProps | [Tabs](/components/tabs-cn#tabs) | - | - | |
|
2020-10-09 10:08:52 +08:00
|
|
|
|
| title | 卡片标题 | ReactNode | - | |
|
2019-07-11 14:14:33 +08:00
|
|
|
|
| type | 卡片类型,可设置为 `inner` 或 不设置 | string | - | |
|
|
|
|
|
| onTabChange | 页签切换的回调 | (key) => void | - | |
|
2017-07-07 13:36:54 +08:00
|
|
|
|
|
|
|
|
|
### Card.Grid
|
|
|
|
|
|
2022-11-17 17:31:26 +08:00
|
|
|
|
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|
|
|
|
|
| --------- | ---------------------- | ------------- | ------ | ---- |
|
|
|
|
|
| className | 网格容器类名 | string | - | |
|
|
|
|
|
| hoverable | 鼠标移过时可浮起 | boolean | true | |
|
|
|
|
|
| style | 定义网格容器类名的样式 | CSSProperties | - | |
|
2017-08-09 14:34:10 +08:00
|
|
|
|
|
|
|
|
|
### Card.Meta
|
|
|
|
|
|
2022-11-17 17:31:26 +08:00
|
|
|
|
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|
|
|
|
|
| ----------- | ------------------ | ------------- | ------ | ---- |
|
|
|
|
|
| avatar | 头像/图标 | ReactNode | - | |
|
|
|
|
|
| className | 容器类名 | string | - | |
|
|
|
|
|
| description | 描述内容 | ReactNode | - | |
|
|
|
|
|
| style | 定义容器类名的样式 | CSSProperties | - | |
|
|
|
|
|
| title | 标题内容 | ReactNode | - | |
|
2023-04-11 10:25:24 +08:00
|
|
|
|
|
|
|
|
|
## Design Token
|
|
|
|
|
|
|
|
|
|
<ComponentTokenTable component="Card"></ComponentTokenTable>
|