当前位置:   article > 正文

elementui el-upload在on-change中校验文件类型错误时隐藏文件列表_elementplus el-upload不符合要求的文件不显示在上传列表

elementplus el-upload不符合要求的文件不显示在上传列表

在这里插入图片描述

<el-upload
                        
                        ref="uploadref"
                        :limit="1"
                        :action="url"
                        :on-change="handleChang"
                        :on-exceed="handleExceed"
                        :auto-upload="false"
                        :on-success="ywzgdw_data"
                        >
                        <el-button slot="trigger" size="small" type="danger">上传</el-button>
                      </el-upload>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
handleChang(file, fileList, index){
	// 检测文件类型不符合时终止显示文件列表
	if(file.type != 'application/pdf'){
		this.$message.error('只能上传 pdf 文件')
		console.log(this.$refs.uploadref)
		this.$refs.uploadref.uploadFiles=[];
		return false;
	}
	
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

参考:https://blog.csdn.net/m0_60908822/article/details/122079494

本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号