elementui中上传文件做校验,文件上传后检验语句消失
<el-form-item label="附件" label-width="100px" prop="docsNew" ref="headimgUpload"> <div class="file-con"> <div :key="key" v-for="(i, key) in item.docsNew" class="file-detail"> <div style="display: flex"> <el-tooltip effect="dark" :content="i.docName" placement="top-start"> <span class="file-name" >{{i.docName}}</span> </el-tooltip> <!-- <span style="padding-right: 40px">{{i.date}}</span> --> <!-- 删除 --> <span @click="handleRemove(item.docsNew, key)" ><i class="el-icon-delete"></i> </span> </div> </div> </div> <!-- 上传 --> <div @click="getPicture(index)" style="width: 100px"> <upload @handleAvatarSuccess="handleAvatarSuccessDocsNew" :baseUrl="baseUrl"></upload> </div> </el-form-item>
handleAvatarSuccessDocsNew(fileData){ if(fileData.code == 200){ Message.info(fileData.message) let file = this.handleFileData(fileData) this.form.eventParts[this.index].docsNew.push(file) console.log("this.$refs.headimgUpload1", this.$refs.headimgUpload) this.$nextTick(() => { this.$refs.headimgUpload[this.index].clearValidate(); // 关闭校验 }) }else { Message.info(fileData.message) } },
getPicture(index){
this.index = index;
},