pengzhanbo 0fd6cac574
refactor(theme): improve types and flat config (#524)
* refactor(theme): improve types
2025-03-16 02:29:30 +08:00

86 lines
2.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: 链接卡片
icon: solar:card-send-linear
createTime: 2024/08/18 23:14:00
permalink: /guide/components/link-card/
---
## 概述
使用 `<LinkCard>` 组件在页面中显示链接卡片。
## Props
| 名称 | 类型 | 默认值 | 说明 |
| ----------- | --------------------------- | ------ | ---------------------------------------------------------------- |
| title | `string` | `''` | 标题 |
| icon | `string \| { svg: string }` | `''` | 显示在标题左侧的图标,支持 iconify 所有图标,也可以使用 图片链接 |
| href | `string` | `''` | 链接 |
| description | `string` | `''` | 详情 |
## 插槽
| 名称 | 说明 |
| ------- | ------------ |
| default | 卡片详情内容 |
| title | 自定义标题 |
## 示例
**输入:**
```md :no-line-numbers
<LinkCard title="卡片标题" href="/" description="这里是卡片内容" />
<LinkCard icon="twemoji:astonished-face" title="卡片标题" href="/" />
```
**输出:**
<LinkCard title="卡片标题" href="/" description="这里是卡片内容" />
<LinkCard icon="twemoji:astonished-face" title="卡片标题" href="/" />
使用组件插槽,可以实现更丰富的表现。
**输入:**
```md :no-line-numbers
<LinkCard title="卡片标题" href="/">
- 这里是卡片内容
- 这里是卡片内容
</LinkCard>
<LinkCard href="/">
<template #title>
<span style="color: red" >卡片标题</span>
</template>
- 这里是卡片内容
- 这里是卡片内容
</LinkCard>
```
**输出:**
<LinkCard title="卡片标题" href="/">
- 这里是卡片内容
- 这里是卡片内容
</LinkCard>
<LinkCard href="/">
<template #title>
<span style="color: red" >卡片标题</span>
</template>
- 这里是卡片内容
- 这里是卡片内容
</LinkCard>
:::info
在插槽内也可以使用 markdown 语法但需要注意的是markdown 语法需要与 标签之间间隔一行。
否则将被识别为普通文本。
:::