Skip to content

Attachments 输入附件

用于展示一组附件信息集合。

何时使用

Attachments 组件用于需要展示一组附件信息集合的场景。

代码演示

基本

基础用法,可以通过 getDropContainer 支持拖拽上传。

查看源代码

占位信息

修改占位信息。

Click or Drop files here
Support file type: image, video, audio, document, etc.

Click or Drop files here

查看源代码

超出样式

控制附件超出区域长度时的展示方式。

Data
查看源代码

组合示例

配合 Sender.Header 使用,在对话中插入附件。

Attachments
Upload Sample
Click or drag files to this area to upload
查看源代码

文件卡片

单独的文件卡片,用于一些展示场景。

excel-file
.xlsx
109 KB
word-file
.docx
217 KB
pdf-file
.pdf
434 KB
ppt-file
.pptx
543 KB
video
video-file
.mp4
651 KB
audio
audio-file
.mp3
760 KB
zip-file
.zip
868 KB
markdown-file
.md
Custom description here
查看源代码

Attachments Props

继承 element-plus ElUpload 属性。

属性说明类型默认值版本
classNames自定义样式类名Record<string, string>--
disabled是否禁用booleanfalse-
getDropContainer设置拖拽时,可以释放文件的区域() => HTMLElement--
items附件列表,同 Upload fileListAttachment[]--
overflow文件列表超出时样式'wrap' | 'scrollX' | 'scrollY'--
placeholder没有文件时的占位信息PlaceholderType | ((type: 'inline' | 'drop') => PlaceholderType)--
rootClassName根节点的样式类名string--
rootStyle根节点的样式对象CSSProperties--
styles自定义样式对象Record<string, CSSProperties>--

Attachments Slots

插槽名说明类型
iconicon区域内容-
title标题区域内容-
placeholder没有文件时的占位信息-

Attachments Expose

属性说明类型版本
nativeElement获取原生节点HTMLElement-
upload手工调用上传文件(file: UploadFile) => void-

Attachments.FileCard Props

属性说明类型默认值版本
item附件,同 Upload UploadFileAttachment--
onRemove附件移除时的回调函数(item: Attachment) => void--