Skip to content

卡片 Card


通用卡片容器

何时使用

  • 最基础的卡片容器,可承载文字、列表、图片、段落,常用于后台概览页面

基本使用

Default size card

card content

card content

card content

Show Code
vue
<template>
  <Card title="Default size card" :width="300">
    <template #extra><a href="#">more</a></template>
    <p>card content</p>
    <p>card content</p>
    <p>card content</p>
  </Card>
</template>

小尺寸卡片

Small size card

card content

card content

card content

Show Code
vue
<template>
  <Card size="small" title="Small size card" :width="300">
    <template #extra><a href="#">more</a></template>
    <p>card content</p>
    <p>card content</p>
    <p>card content</p>
  </Card>
</template>

在灰色背景上使用无边框的卡片

Card title

Card content

Card content

Card content

Show Code
vue
<template>
  <div style="display: inline-block; background: #ececec; padding: 30px; border-radius: 8px;">
    <Card title="Card title" :bordered="false" :width="300">
      <p>Card content</p>
      <p>Card content</p>
      <p>Card content</p>
    </Card>
  </div>
</template>

自定义标题和内容区域样式

Default size card

card content

card content

card content

Show Code
vue
<template>
  <Card
    title="Default size card"
    :width="300"
    :headStyle="{ fontSize: '18px', color: '#fff', backgroundColor: '#1677ff'}"
    :bodyStyle="{ fontSize: '16px', color: '#fff', backgroundColor: '#52c41a'}">
    <template #extra><a href="#">more</a></template>
    <p>card content</p>
    <p>card content</p>
    <p>card content</p>
  </Card>
</template>

内部卡片

Card title

Group title

Inner card title
Inner Card content
Inner card title
Inner Card content
Show Code
vue
<template>
  <Card title="Card title" :width="360">
    <p style="font-size: 14px; color: rgba(0, 0, 0, 0.85); margin-bottom: 16px; font-weight: 500;">
      Group title
    </p>
    <Card title="Inner card title">
      <template #extra>
        <a href="#">More</a>
      </template>
      Inner Card content
    </Card>
    <Card title="Inner card title" :style="{ marginTop: '16px' }">
      <template #extra>
        <a href="#">More</a>
      </template>
      Inner Card content
    </Card>
  </Card>
</template>

栅格卡片

Show Code
vue
<template>
  <div style="background-color: #ececec; padding: 20px; border-radius: 8px;">
    <Row :gutter="16">
      <Col :span="8">
        <Card title="Card title" :bordered="false">
          <p>card content</p>
        </Card>
      </Col>
      <Col :span="8">
        <Card title="Card title" :bordered="false">
          <p>card content</p>
        </Card>
      </Col>
      <Col :span="8">
        <Card title="Card title" :bordered="false">
          <p>card content</p>
        </Card>
      </Col>
    </Row>
  </div>
</template>

简洁卡片

Card content

Card content

Card content

Show Code
vue
<template>
  <Card :width="300">
    <p>Card content</p>
    <p>Card content</p>
    <p>Card content</p>
  </Card>
</template>

APIs

参数说明类型默认值必传
width卡片宽度number | string'auto'false
bordered是否有边框booleantruefalse
extra卡片右上角的操作区域string | slot''false
size卡片的尺寸'default' | 'small''default'false
title卡片标题string | slot''false
headStyle标题区域自定义样式CSSProperties{}false
bodyStyle内容区域自定义样式CSSProperties{}false

Released under the MIT License.