固定上传文件个数
if(vm.fileList.length!==2){ this.$message.warning(`请上传有且仅有2个文件。`); return }
限制上传文件个数
<el-form-item label="上传文件" prop="fileList"> <el-upload ref="upload" multiple name="File" :action="apis.manageModel" :auto-upload="false" :limit="2" :http-request="httpRequest" :file-list="fileList" :on-exceed = "cmx.fileOption.handleExceed" :on-change="cmx.fileOption.onChangeUpload" :before-remove="cmx.fileOption.beforeRemove" :on-remove="handleRemove" :before-upload="cmx.fileOption.beforeAvatarUpload" > <el-button size="small" type="primary">点击上传</el-button> <span slot="tip" class="el-upload__tip"> 只能上传一组同名dll、xml文件</span> </el-upload> </el-form-item> handleExceed(files, fileList) { this.$message.warning(`请最多上传 ${this.limit} 个文件。`); },
到此这篇ElementUI上传文件-限制上传文件个数的文章就介绍到这了,更多相关内容请继续浏览下面的相关推荐文章,希望大家都能在编程的领域有一番成就!
版权声明:
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若内容造成侵权、违法违规、事实不符,请将相关资料发送至xkadmin@xkablog.com进行投诉反馈,一经查实,立即处理!
转载请注明出处,原文链接:https://www.xkablog.com/qdkf/11267.html