案例文件下载上传优化

This commit is contained in:
xiezhijun
2021-03-09 11:21:30 +08:00
parent 728b93cbdc
commit 4b58e1b6bc
3 changed files with 24 additions and 8 deletions

View File

@ -56,7 +56,7 @@ export default {
},
methods: {
uploadFile(){
if(this.upload.fileList.length > 0 && this.uploadResult.fileUrl.length != this.upload.fileList.length){
if(this.upload.fileList.length > 0 && this.uploadResult.fileUrl.length < this.upload.fileList.length){
this.$refs.upload.submit();
}else{
this.$emit('callbackMethod', this.uploadResult);
@ -106,19 +106,21 @@ export default {
}else{
this.upload.fileList = fileList.pop();
this.$message.error('文件上传失败,请检查文件格式');
this.$emit('changeSubmitFlag', false);
}
},
// 文件上传失败处理
handleFileFail(err, file, fileList){
this.$message.error('文件上传失败,请检查文件格式');
this.upload.fileList = fileList.pop();
this.$emit('changeSubmitFlag', false);
}
},
props: {
},
created() {
this.uploadReset();
//this.uploadReset();
},
};

View File

@ -134,12 +134,14 @@ export default {
}else{
this.upload.fileList = fileList.pop();
this.$message.error('文件上传失败,请检查文件格式');
this.$emit('changeSubmitFlag', false);
}
},
// 文件上传失败处理
handleFileFail(err, file, fileList){
this.$message.error('文件上传失败,请检查文件格式');
this.upload.fileList = fileList.pop();
this.$emit('changeSubmitFlag', false);
}
},
props: {
@ -153,6 +155,12 @@ export default {
created() {
},
watch : {
caseFileList:function(newVal, oldVal) {
//console.log(newVal.length);
this.oldCaseFileList = newVal;
}
}
};
</script>