FileCard 文件卡片
用卡片的形式展示文件。
何时使用
- 用于在对话或输入时展示文件。
代码演示
基础用法
excel-has-long-long-long-name.xlsx
1 KB
word-file.docx
1 KB
pdf-file.pdf
1 KB
ppt-file.pptx
1 KB
zip-file.zip
1 KB
txt-file.txt
1 KB
markdown-file.md
1 KB
java-file.java
1 KB
javascript-file.js
1 KB
python-file.py
1 KB
excel-file.xlsx
1 KB
卡片大小
pdf-file.pdf
1 KB
pdf-file.pdf
1 KB
图片文件

Preview

Preview
image-file.png
1 KB
图片加载
0%
0%
音视频类型
audio-file.mp3
1 KB
video-file.mp4
1 KB
使用遮罩
txt-file.txt
1 KB
自定义图标
txt-file.txt
1 KB
android-file.apk
1 KB
文件列表
excel-file.xlsx
1 KB
word-file.docx
1 KB
pdf-file.pdf
1 KB
ppt-file.pptx
1 KB
zip-file.zip
1 KB
txt-file.txt
1 KB
excel-file.xlsx
1 KB
word-file.docx
1 KB
pdf-file.pdf
1 KB
ppt-file.pptx
1 KB
zip-file.zip
1 KB
txt-file.txt
1 KB

Preview

Preview

Preview

Preview

Preview

Preview

Preview

Preview

Preview
超出样式

Preview

Preview

Preview

Preview

Preview

Preview

Preview

Preview

Preview

Preview

Preview
excel-file.xlsx
1 KB
word-file.docx
1 KB
pdf-file.pdf
1 KB
ppt-file.pptx
1 KB
zip-file.zip
1 KB
txt-file.txt
1 KB
API
FileCardProps
| 属性 | 说明 | 类型 | 默认值 | 版本 |
|---|---|---|---|---|
| name | 文件名称 | string | - | - |
| byte | 文件大小(字节) | number | - | - |
| size | 卡片大小 | 'small' | 'default' | 'default' | - |
| description | 文件描述 | VNode | string | - | - |
| loading | 是否处于加载状态 | boolean | false | - |
| type | 文件类型 | 'file' | 'image' | 'audio' | 'video' | string | - | - |
| src | 图片或文件地址 | string | - | - |
| mask | 遮罩内容 | VNode | string | - | - |
| icon | 自定义图标 | VNode | PresetIcons | - | - |
| imageProps | 图片属性,同 ant-design-vue Image 属性 | ImageProps | - | - |
| videoProps | 视频属性配置 | Record<string, any> | - | - |
| audioProps | 音频属性配置 | Record<string, any> | - | - |
| spinProps | 加载中属性 | SpinProps & { showText?: boolean; icon?: VNode } | - | - |
| onClick | 点击事件回调 | () => void | - | - |
PresetIcons
预设图标类型,支持以下值:
typescript
type PresetIcons =
| 'default' // 默认文件图标
| 'excel' // Excel 文件图标
| 'image' // 图片文件图标
| 'markdown' // Markdown 文件图标
| 'pdf' // PDF 文件图标
| 'ppt' // PowerPoint 文件图标
| 'word' // Word 文件图标
| 'zip' // 压缩文件图标
| 'video' // 视频文件图标
| 'audio' // 音频文件图标
| 'java' // Java 文件图标
| 'javascript' // JavaScript 文件图标
| 'python'; // Python 文件图标FileCard.List
文件列表组件,用于展示多个文件卡片。
| 属性 | 说明 | 类型 | 默认值 | 版本 |
|---|---|---|---|---|
| items | 文件列表数据。每一项是 FileCardProps,并可用 key 作为稳定标识;缺省时回退为 name-index | (FileCardProps & { key?: string | number })[] | - | - |
| size | 卡片大小 | 'small' | 'default' | 'default' | - |
| removable | 是否可删除 | boolean | ((item: FileCardProps) => boolean) | false | - |
| onRemove | 删除事件回调 | (item: FileCardProps) => void | - | - |
| extension | 扩展内容 | VNode | - | - |
| overflow | 超出展示方式 | 'scrollX' | 'scrollY' | 'wrap' | 'wrap' | - |
Semantic DOM
pdf-file.pdf
1 KB
root
根节点file
文件icon
图标name
名称description
描述
excel-file.xlsx
1 KB
excel-file.xlsx
1 KB
excel-file.xlsx
1 KB
root
根节点card
卡片file
文件icon
图标name
名称description
描述
主题变量(Design Token)
组件暂无自定义 Component Token,可通过全局 Design Token 定制。