improve: 上传判断

This commit is contained in:
From-wh 2023-06-26 14:52:09 +08:00
parent d0597896ca
commit 379434cc31

View File

@ -62,6 +62,7 @@ export default {
},
methods: {
selectImgs() {
if (this.loading) return;
this.$refs['upload'].$refs['upload-inner'].handleClick();
},
again() {
@ -70,14 +71,19 @@ export default {
this.allSize = 0;
},
async submitUpload() {
this.loading = true;
for (let i = 0; i < this.imgList.length; i++) {
const file = this.imgList[i].raw;
await this.uploadItem(file);
if (i == this.imgList.length - 1) {
this.uploading = false;
this.loading = false;
if (this.imgList.length) {
if (this.loading) return;
this.loading = true;
for (let i = 0; i < this.imgList.length; i++) {
const file = this.imgList[i].raw;
await this.uploadItem(file);
if (i == this.imgList.length - 1) {
this.uploading = false;
this.loading = false;
}
}
} else {
this.$Message.warning('请先选择图片');
}
},
handleRemove(file) {