|
|
@@ -162,6 +162,7 @@ export default { |
|
|
|
dataList: [], |
|
|
|
loading: false, |
|
|
|
file: {}, |
|
|
|
uploading:false |
|
|
|
}; |
|
|
|
}, |
|
|
|
created() { |
|
|
@@ -215,7 +216,20 @@ export default { |
|
|
|
input.addEventListener( |
|
|
|
"change", |
|
|
|
(upload = (e) => { |
|
|
|
input.removeEventListener('change',upload) |
|
|
|
if(this.uploading){ |
|
|
|
this.$message({ |
|
|
|
type:"warning", |
|
|
|
message:"正在上传" |
|
|
|
}) |
|
|
|
return |
|
|
|
} |
|
|
|
this.uploading=true |
|
|
|
let file = e.target.files[0]; |
|
|
|
if(!file){ |
|
|
|
this.uploading=false |
|
|
|
return |
|
|
|
} |
|
|
|
let MAXSIZE = 5 * 1024 * 1024; |
|
|
|
if (file.size > MAXSIZE) { |
|
|
|
this.$message.error("上传文件不得超过5M"); |
|
|
@@ -237,7 +251,8 @@ export default { |
|
|
|
}) |
|
|
|
.catch((e) => { |
|
|
|
this.$message.error("上传文件失败"); |
|
|
|
}).catch(e=>{ |
|
|
|
}).finally(e=>{ |
|
|
|
this.uploading=false |
|
|
|
this.getFile() |
|
|
|
}); |
|
|
|
}) |