element upload 上传文件报错status of undefined
生活随笔
收集整理的這篇文章主要介紹了
element upload 上传文件报错status of undefined
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
upload 上傳報錯
場景再現(xiàn):點擊編輯數(shù)據(jù),修改上傳文件,確定提交修改,關閉彈窗,清空數(shù)據(jù)和清空附件。
錯誤提示:上傳報錯,下圖; Uncaught TypeError: Cannot set property ‘status’ of undefined
報錯原因:設置了:file-list=“fileList”,filelist為只讀,修改后就會報錯 Cannot set property ‘status’ of undefined
解決方法:在成功回調(diào)中用setTimeout清空上傳列表即可解決。
核心代碼:
setTimeout(() => {this.$refs.upload.clearFiles();}, 100);具體方法代碼:
this.$refs[forms].validate((valid) => {if (valid) {EditTrainingRecord(this.form).then((res) => {if (res.status == 200) {this.folder.folderId = this.form.accessory;this.submitUpload();this.$message({message: "添加成功",type: "success",center: true,showClose: true,});//清空附件列表setTimeout(() => {this.dialogFormVisible = false;this.$refs.upload.clearFiles();}, 100);this.getList();} else {this.$message({message: res.content,type: "warning",});}}).catch((res) => {this.dialogVisible = false;this.$message({message: "系統(tǒng)異常,請聯(lián)系管理員",center: true,type: "error",});});} else {console.log("error submit!!");return false;}});總結(jié)
以上是生活随笔為你收集整理的element upload 上传文件报错status of undefined的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【汇编程序】实现输出2012-2100年
- 下一篇: UG NX二次开发 - CAM 获取和设