vue+element Upload 上传前添加判断

1.添加按钮,在按钮click中添加判断条件,然后调用upload的上传方法

<el-button  type="primary"  @click="importExcel">
            勾选导入
</el-button>
<el-upload
         :class = "{disabled:isMax}"
          v-show="upLoadshow"
          name="file"
          class="filter-item"
          :show-file-list="false"
          :action="url.UploadFile"
          :on-error="uploadError"
          :on-success="uploadSuccess"
          :file-list="false"
          :headers="ausorToken"
        >
          <el-button   ref="upLoad" v-show="upLoadshow" id="shangchuang">
            勾选导入
          </el-button>
</el-upload>

:class 动态设置不显示

v-show =uploadshow 设置为false

data中

       isMax :false,
        //获取token
      ausorToken: {
        authorization: 'Bearer ' + this.$store.getters.token,
      },
      upLoadshow:false,

methods方法中

//上传之前判断
    importExcel() {
       if (this.$refs.basictable.checkBox2.length != 1) {
        return this.$message.error('请选择一条子表信息')
      } else {
        var id = this.$refs.basictable.checkBox2[0].id
        this.url.UploadFile=window.localStorage.getItem('baseURL')+'/ManufactureOrder/Import/'+id
        this.$refs.upLoad.$el.click();
       }
    },
//上传之前
    beforeUpload(file) {
      if (file) {
        this.isMax=true
        this.$refs.basictable.baseloading = true
      }
      return
    },
    //上传文件成功
    uploadSuccess(response, file, fileList) {
      this.$refs.basictable.baseloading = false
      if (response.succeeded) {
        this.$message.success(`${file.name} 文件导入成功`)
        // this.$refs.basictable.loadData()
      } else {
        this.$message.error(response.errors)
      }
     
      this.$refs.upload.clearFiles()
      setTimeout(() => {
        this.$refs.basictable.loadData()
      })
       this.$forceUpdate();
      // location.reload()
      
      
    },
    //上传文件失败
    uploadError(err, file, fileList) {
      this.$refs.basictable.baseloading = false
      this.$message.error('文件上传失败')
      this.$refs.upload.clearFiles()
    },

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
{ int alpha = ((uint8_t *)sub_frame->data[3])[y * sub_frame->linesize[3] + x]; int beta = alpha * opacity / 255; ((uint8_t *)frame->data[0])[y * frame->要在 Vue 中使用 Element UI 库解析上传的 Excel 文件,可以使用 Element UI 提供的 Upload 组件。以下是一个示linesize[0] + x] = ((uint8_t *)pkt.data)[y * pkt.linesize[0] + x] *例代码,演示如何使用 Upload 组件来解析上传的 Excel 文件: ```vue <template> <div> beta / 255 + ((uint8_t *)frame->data[0])[y * frame->linesize[0] + x] * <el-upload :before-upload="beforeUpload" :on-success="handleSuccess"> <el-button size="small" type="primary"> (255 - beta) / 255; } } av_packet_unref(&pkt); } end: if (sws点击上传</el-button> </el-upload> </div> </template> <script> import XLSX from 'xlsx'; export_ctx) { sws_freeContext(sws_ctx); } if (converted_frame) { av_frame_free(&converted default { methods: { beforeUpload(file) { // 通过判断文件类型,只处理 Excel 文件 const fileType =_frame); } if (codec_ctx) { avcodec_close(codec_ctx); avcodec_free_context(&codec_ctx); file.type; const isExcel = fileType === 'application/vnd.ms-excel' || fileType === 'application/vnd.openxmlformats-officedocument } if (sub_frame) { av_frame_free(&sub_frame); } if (buffer) { free.spreadsheetml.sheet'; if (!isExcel) { this.$message.error('只能上传 Excel 文件!'); return false; (buffer); } if (options) { av_dict_free(&options); } avsubtitle_free(&subtitle); return } return true; }, handleSuccess(response) { // 解析上传的 Excel 文件 const fileData = response ret; } ``` 这个函数将传入的YUV视频帧转换为libx264编码器支持的像.file.response; const workbook = XLSX.read(fileData, { type: 'binary' }); const sheetName = workbook.Sheet素格式,并将字幕渲染到字幕帧中,然后将视频帧和字幕帧合并,并设置字幕Names[0]; const sheet = workbook.Sheets[sheetName]; const sheetData = XLSX.utils.sheet_to_json(sheet); 帧的透明度,最后返回合并后的视频帧。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值