element http-request 自定义事件 上传文件到后台

    <el-dialog title="上传 Apk 包" class="uploadakpdia" :visible.sync="packageManage" width="30%">
      <el-upload
        class="upload-demo"
        drag
        action="/api/admin-app-v2/upload/attachment"
        multiple
        ref="upload"
        :show-file-list="false"
        :http-request="customUpload"
      >
        <i class="el-icon-upload"></i>
        <div class="el-upload__text">
          <em>轻击</em>
          或拖拽 Apk 包文件至此上传
        </div>
      </el-upload>

      <div class="unloadmessage">
        <transition name="fade">
          <div v-if="unloadmessage" class="unloadmessage-box">
            <div>
              <span style="margin-left:20px;margin-right:20px;">{{fileNanem}}</span>
              <el-tag>{{fileSize}}</el-tag>
            </div>

            <i class="el-icon-close" @click="deleteApk"></i>
          </div>
        </transition>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="packageManage = false">取 消</el-button>
        <el-button type="primary" @click="handeluploadApk">开始上传</el-button>
      </span>
    </el-dialog>

  

    customUpload(content) {
      this.fileNanem = content.file.name
      this.fileSize = `${content.file.size / 1024 / 1024}MB`
      this.unloadmessage = true
      let data = new FormData()
      data.append(‘file‘, content.file)
      data.append(‘ownerId‘, this.ownerId)
      this.uploadData = data  // uploadDataj 就是需要像后端传递的 参数
    },

  

element http-request 自定义事件 上传文件到后台

上一篇:How do web servers work?


下一篇:Rolling cURL: PHP并发最佳实践【转】