• 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 就是需要像后端传递的 参数
        },
    

      

  • 相关阅读:
    堆(优先队列)模板
    线段树(递归)模板
    快速幂(含二阶方阵类)模板
    ACM/CF赛制getstart模板
    [Andrew Stankevich's Contest#21] Lempel-Ziv Compression
    [NOIP2001]Car的旅行路线
    [NOIP2007] 矩阵取数游戏
    [NOIP2010] 关押罪犯
    [NOIP1999] 拦截导弹
    设计模式之第1章-工厂方法模式(Java实现)
  • 原文地址:https://www.cnblogs.com/SuperBrother/p/13141380.html
Copyright © 2020-2023  润新知