首页 > 其他分享 >ElementUi Upload组件判断文件是否上传中

ElementUi Upload组件判断文件是否上传中

时间:2022-11-23 20:22:45浏览次数:47  
标签:ElementUi componentName Upload 传中 eventName params isUploading child uploadFiles

// 是否存在上传中 let isUploading = false function broadcast(componentName, eventName, params) {   this.$children.forEach(child => {     var name = child.$options.name     if (name === componentName) {       console.log('child.uploadFiles', child.uploadFiles)       if (child.uploadFiles && child.uploadFiles.length > 0) {         child.uploadFiles.forEach((item) => {           if (item.status && item.status === 'uploading') {             isUploading = true             return           }         })       }     } else {       broadcast.apply(child, [componentName, eventName].concat([params]))     }   }) } export default {   methods: {     // 是否存在上传中文件     isUploading(componentName = 'ElUpload', eventName, params) {       isUploading = false       broadcast.call(this, componentName, eventName, params)       return new Promise((resolve) => {         if (isUploading) {           this.$confirm('您确认要放弃未完成的文件上传吗?', '提示', {             confirmButtonText: '确定',             cancelButtonText: '取消',             type: 'warning'           }).then(() => {             resolve(true)           }).catch(() => {             resolve(false)           })         } else {           resolve(true)         }       })     }   } }

标签:ElementUi,componentName,Upload,传中,eventName,params,isUploading,child,uploadFiles
From: https://www.cnblogs.com/zerofan/p/16919662.html

相关文章

  • 你是甄嬛传中的谁
    甄嬛传最近挺火的,美女好多,女人之间的斗争,永远是最残酷的斗争.而后宫,是残酷的密集地.流潋紫笔下的后宫,后宫中那群如花似月的女子,或许有显赫的家世,或许有绝美的容颜,机巧......
  • elementUI tree树节点文字超出时省略或折行 样式
    文字超出时折行::v-deep.tree{width:100%;.el-tree-node{white-space:normal;.el-tree-node__content{height:100%;a......
  • idea使用commons-fileupload上传文件
    文件上传使用的工具:https://commons.apache.org/proper/commons-fileupload/faq.html文件上传的前提条件:form表单method="post"form表单enctype="multipart/form-data"......
  • SpringBoot使用ServletFileUpload上传文件时servletFileUpload.parseRequest(request)
    1.问题描述1.1SpringBoot使用ServletFileUpload上传文件时List<FileItem>items=servletFileUpload.parseRequest(request)为空//获取ServletFileUploadServletF......
  • vue elementui Switch组件添加开关样式
      /deep/.el-switch{   &::before{    content:'开';    display:none;    color:#fff;    z-index:1;  ......
  • Pikachu-unsafe upfileupload
    clientcheck(客户端)通过查看源代码可以发现,此处判断图片是在前端使用js进行判断那么我们禁用js,直接上传php木马文件MIMEtype(服务器端)在这里我们还是选择php文件,......
  • iview upload 手动上传
      <template><divclass="batchAddCustomer-container"><pclass="tit-p">水电管理</p><divclass="downtext">下载模板</div><divclass="text"......
  • Vue中使用el-upload+XLSX实现解析excel文件为json数据
    场景业务要求为实现每天上报各部门计划人数,需要通过excel导入数据。前端可以解析excel数据并进行初步的格式校验。  导入成功之后解析的数据  excel里的数据......
  • asp.net中FileUpload控件研究汇总
    .aspx代码如下:<%@PageLanguage="C#"AutoEventWireup="true"CodeFile="文件上传.aspx.cs"Inherits="文件上传"%><!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transi......
  • elementui中el-checkbox 选中时的详细介绍
    checkbox-group把多个checkbox管理为一组(需要注意的坑)很多时候我们需要会遇见这样的场景。比如用户需要选择多个值.这个时候我们需要把多个checkbox放置在checkbox......