zoukankan      html  css  js  c++  java
  • el-upload 二次或者多次选择文件失效

    代码

     <el-upload class="upload-box"
                           action=""
                           accept=".ppt,.pdf"
                           :limit='1'
                           :on-change="changeFile"
                       ref="upload"
                           :show-file-list="false"
                           :auto-upload="false">
              
                        <el-button :type="form.otherInfo.length>0?'warning':'info'" slot="trigger">{{form.otherInfo.length>0?'重新上传':'点击上传'}}</el-button>
                        <span>格式为ppt/pdf,其他资料小于20MB</span>
      </el-upload>
                
     changeFile (file, fileList) {
     
          console.log('change', file, file.raw)
          if(file.raw.size>10*1024*1024){
            this.$message.warning(`格式为pdf,报名表大小小于10M`)
            return 
          }
           if (fileList.length > 0) {
            this.fileList = [fileList[fileList.length - 1]]//这一步,是 展示最后一次选择文件
          }
          this.sendFile('pdf',file)//上传文件
          this.$refs.upload.clearFiles(); //清空当前 files
        },
    

      生效

  • 相关阅读:
    ER图
    uml图
    第一个迭代任务的制作
    软件测试
    实训记录
    UML系列图——ER图
    UML系列图——用例图
    第一个迭代任务进度
    第一个迭代任务
    需求分析——WBS
  • 原文地址:https://www.cnblogs.com/GoTing/p/14899259.html
Copyright © 2011-2022 走看看