文件批量上传 使用axios实现

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/github_35631540/article/details/80991062
addDialogCB (data) {
        // 如有数据 判定点确认
        if (data) {
          this.showType = 'table'
          var formData = new FormData()
          formData.append('fileType', 0)
          formData.append('remark', data.remark)
          for (let i = 0; i < data.files.length; i++) {
            formData.append('multipartFiles', data.files[i])
          }
          uploadManyOfficeDoc(formData).then(res => {
            if (res.data.code === 0) {
              this.tableId = res.data.data
              this.getOfficeDocByPage()
            } else {
              this.$message({
                type: 'error',
                message: res.data.msg
              })
            }
          })
        }
        this.dialogAddVisitVisible = false
      }


<input type="file" style="display: none;" multiple id="uploader" @change="fileChange($event)"/>
山重水复疑无路,柳暗花明又一村


猜你喜欢

转载自blog.csdn.net/github_35631540/article/details/80991062