diff --git a/components/tm-upload/tm-upload.vue b/components/tm-upload/tm-upload.vue index 9c26e5f..1ef692d 100644 --- a/components/tm-upload/tm-upload.vue +++ b/components/tm-upload/tm-upload.vue @@ -7,11 +7,11 @@ class="sunui-uploader-file" /> - + x - {{item.upload_percent}}% + @@ -185,6 +185,7 @@ export default { if (Math.ceil(res.size / 1024) < this.upload_video_max * 1024) { await this.upload_img_size.push(Math.ceil(res.size / 1024)); await this.upload_before_list.push(res); + this.$forceUpdate() } else { this.upload_exceeded_list.push(1); @@ -219,6 +220,7 @@ export default { if (Math.ceil(res.tempFiles[i].size / 1024) < this.upload_max * 1024) { await this.upload_img_size.push(Math.ceil(res.tempFiles[i].size / 1024)); await this.upload_before_list.push(res.tempFiles[i]); + this.$forceUpdate() // TODO v3.1增加图片格式限制 } else { res.tempFilePaths.splice(i, 1); @@ -239,6 +241,7 @@ export default { } this.upload_cache = await res.tempFilePaths; this.upload(this.upload_auto); + this.$forceUpdate() }, fail: (err) => { console.log(err); @@ -338,7 +341,12 @@ export default { uploadTask.onProgressUpdate(async (res) => { // this.upload_before_list[this.upload_before_list.length-1].upload_percent = await res.progress; - for(let i in this.upload_before_list) { if(this.upload_before_list[i].upload_percent != 100) { this.upload_before_list[i].upload_percent = await res.progress; break; } }; + for (let i in this.upload_before_list) { + if (this.upload_before_list[i].upload_percent != 100) { + console.log(res.progress, '-----------res.progress-----------'); + this.upload_before_list[i].upload_percent = await res.progress + } + }; }); } }