ant-design-vue 上传组件Upload中文件列表下载功能实现
代码:
1、首先在showUploadList属性中将下载的icon显示出来。
<Upload
v-model:file-list="fileList"
name="file"
:before-upload="beforeUpload"
:action="uploadUrl"
:headers="headers"
@change="handleChange"
:showUploadList="{
showRemoveIcon: true,
showDownloadIcon: true
}"
@download="handleDownload"
>
<Button><UploadOutlined></UploadOutlined>上传文件</Button>
</Upload>
2、点击下载的icon,会触发download事件,在download事件中调用下载文件的接口。
3、点击文件下载,需要将下载的链接添加到fileList的url里。