实现步骤
  1. 设置移入后展示的标签,绑定点击事件 handleDownload(file),file 是文件的相关信息
<span class="el-upload-list__item-actions" style="font-size: 16px; padding: 0 10px">
  <span
  v-if="!disabled"
  class="el-upload-list__item-download"
  style="margin: 0 10px 0 0"
  @click="handleDownload(file)"
  >
    <i class="el-icon-download"></i>
  </span>
</span>
  1. 对点击事件进行处理
// 下载文件时的钩子
    handleDownload (file) {
      // 查看点击事件后传递过来的数据
      console.log(file, '下载文件事件')
      // 创建 a 标签
      const a = document.createElement('a')
      // 创建一个点击事件
      const event = new MouseEvent('click')
      // 将 a 的 download 属性设置为我们想要下载的图片的名称,若 name 不存在则使用'图片'作为默认名称
      a.download = file.name || '文件名称'
      // 将生成的 url 设置为 a.href 属性 (file.downloadUrl 属性也是一个链接,是一个自定义的链接)
      a.href = file.downloadUrl
      // 打开新的窗口(如果是一个图片类型的文件,在浏览器打开新的标签页打开)
      a.target = '_blank'
      // 实现触发生成的 a 标签
      a.dispatchEvent(event)
    }