|
|
@@ -1,6 +1,7 @@
|
|
1
|
1
|
<template>
|
|
2
|
2
|
<div class="component-upload-image">
|
|
3
|
3
|
<el-upload
|
|
|
4
|
+ multiple
|
|
4
|
5
|
:action="uploadImgUrl"
|
|
5
|
6
|
list-type="picture-card"
|
|
6
|
7
|
:on-success="handleUploadSuccess"
|
|
|
@@ -70,6 +71,8 @@ export default {
|
|
70
|
71
|
},
|
|
71
|
72
|
data() {
|
|
72
|
73
|
return {
|
|
|
74
|
+ number: 0,
|
|
|
75
|
+ uploadList: [],
|
|
73
|
76
|
dialogImageUrl: "",
|
|
74
|
77
|
dialogVisible: false,
|
|
75
|
78
|
hideUpload: false,
|
|
|
@@ -119,9 +122,14 @@ export default {
|
|
119
|
122
|
},
|
|
120
|
123
|
// 上传成功回调
|
|
121
|
124
|
handleUploadSuccess(res) {
|
|
122
|
|
- this.fileList.push({ name: res.data.url, url: res.data.url });
|
|
123
|
|
- this.$emit("input", this.listToString(this.fileList));
|
|
124
|
|
- this.loading.close();
|
|
|
125
|
+ this.uploadList.push({ name: res.data.url, url: res.data.url });
|
|
|
126
|
+ if (this.uploadList.length === this.number) {
|
|
|
127
|
+ this.fileList = this.fileList.concat(this.uploadList);
|
|
|
128
|
+ this.uploadList = [];
|
|
|
129
|
+ this.number = 0;
|
|
|
130
|
+ this.$emit("input", this.listToString(this.fileList));
|
|
|
131
|
+ this.loading.close();
|
|
|
132
|
+ }
|
|
125
|
133
|
},
|
|
126
|
134
|
// 上传前loading加载
|
|
127
|
135
|
handleBeforeUpload(file) {
|
|
|
@@ -158,6 +166,7 @@ export default {
|
|
158
|
166
|
text: "上传中",
|
|
159
|
167
|
background: "rgba(0, 0, 0, 0.7)",
|
|
160
|
168
|
});
|
|
|
169
|
+ this.number++;
|
|
161
|
170
|
},
|
|
162
|
171
|
// 文件个数超出
|
|
163
|
172
|
handleExceed() {
|