---
url: /guide/components/image-card/index.md
---
## 概述

使用 `<ImageCard>` 组件在页面中显示图片卡片。

图片卡片有别于 markdown 的普通插入图片方式，它展示与图片相关的更多信息，包括标题、描述、作者、链接等。
适用于如摄影作品、设计作品、宣传海报等场景。

## Props

:::: field-group

::: field image
@type `string`
@required

图片链接地址，本地图片必须使用绝对路径，即以 `/` 开头的路径，指向 `/public` 目录
:::

::: field title
@type `string`

图片标题
:::

::: field description
@type `string`

图片描述信息
:::

::: field author
@type `string`

图片作者
:::

::: field href
@type `string`

点击图片标题后的跳转链接
:::

::: field date
@type `string | Date | number`

图片创作日期
:::

::: field width
@type `string | number`

图片宽度
:::

::: field center
@type `boolean`

图片宽度不满屏时是否居中
:::

::::

## Slots

**该组件不提供插槽。** 所有内容均通过 Props 传入（`image`、`title`、`author`、`date`、`description`、`href`）。

若需要在图片卡片内放置自定义内容，请使用 [`Card`](../components/v-card.md) 或 [`LinkCard`](../components/v-link-card.md) 并在其插槽中自行构建。

## 示例

**输入：**

```md :no-line-numbers
<ImageCard
  image="https://cn.bing.com/th?id=OHR.AlfanzinaLighthouse_ZH-CN9704515669_1920x1080.webp"
  title="阿尔凡齐纳灯塔，阿尔加维，葡萄牙"
  description="今天照片中的灯塔位于葡萄牙南部海岸阿尔加维的卡沃埃罗。阿尔凡齐纳灯塔建于1919年，照耀着大海，帮助船只在该地区周围危险的水域航行。这座灯塔是著名的旅游胜地，同时也是该地区与海洋紧密联系的象征。如果你有幸住在灯塔附近，那么本周末就是拜访灯塔的最佳时机。"
  href="/"
  author="Andreas Kunz"
  date="2024/08/16"
/>
```

**输出：**

还可以放到 `<CardGrid>` 组件中。

**输入：**

```md :no-line-numbers
<CardGrid>
  <ImageCard
    image="https://cn.bing.com/th?id=OHR.AlfanzinaLighthouse_ZH-CN9704515669_1920x1080.webp"
    title="阿尔凡齐纳灯塔，阿尔加维，葡萄牙"
    description="..."
    href="/"
    author="Andreas Kunz"
    date="2024/08/16"
  />
  <ImageCard
    image="https://cn.bing.com/th?id=OHR.AlfanzinaLighthouse_ZH-CN9704515669_1920x1080.webp"
    title="阿尔凡齐纳灯塔，阿尔加维，葡萄牙"
    description="..."
    href="/"
    author="Andreas Kunz"
    date="2024/08/16"
  />
</CardGrid>
```

**输出：**

[查看照片类作品示例](../../blog/1.示例/照片类作品示例.md)
