antd vue upload组件上传多类型文件的使用

170 阅读1分钟

<a-upload :data="{upload_sysName:'flc',upload_folder:'flAttachFile'}" :action="apiUrl.uploadServlet" //当前系统上传的服务器接口 @change="uploadChange" :fileList="fileList" :multiple="true"//点击ctrl,可选择多个文件一次性上传 > 选择文件

  uploadChange({fileList}) {//解构出当前所有附件的主要信息
    this.newFileList = []
    this.fileList = fileList
    this.fileList.forEach(item => {
      const {status,response = {}} = item
      if(status === 'done'){//若要获取已经上传的文件信息,必须判断上传状态,若为done,才可以获取到
        const {fileNameOld,fileType,murl} = response
        this.newFileList.push({
          attachName:fileNameOld,
          attachType:fileType,
          attachUrl:murl,
          attachFolder:0,
        })
      }
    })
  },