固定上传文件个数
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} 个文件。`);
},