Skip to content

Commit bfcbcce

Browse files
committed
add clearAll feature by @robertotnoya issue #6
1 parent a17e543 commit bfcbcce

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

dist/vue-upload-drop-images.vue

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export default {
1414
uploadMsg: String,
1515
maxError: String,
1616
fileError: String,
17+
clearAll: String,
1718
},
1819
methods: {
1920
dragOver() {
@@ -90,6 +91,12 @@ export default {
9091
this.Imgs = values;
9192
});
9293
},
94+
reset() {
95+
this.$refs.uploadInput.value = null;
96+
this.Imgs = [];
97+
this.files = [];
98+
this.$emit("change", this.files);
99+
},
93100
},
94101
};
95102
</script>
@@ -220,6 +227,9 @@ export default {
220227
</p>
221228
</div>
222229
<div class="imgsPreview" v-show="Imgs.length > 0">
230+
<button class="clearButton" @click="reset">
231+
{{ clearAll ? clearAll : "clear All" }}
232+
</button>
223233
<div class="imageHolder" v-for="(img, i) in Imgs" :key="i">
224234
<img :src="img" />
225235
<span class="delete" style="color: white" @click="deleteImg(--i)">
@@ -340,4 +350,13 @@ export default {
340350
.plus:hover {
341351
cursor: pointer;
342352
}
353+
.clearButton {
354+
color: #2d3748;
355+
position: absolute;
356+
top: 7px;
357+
right: 7px;
358+
background: none;
359+
border: none;
360+
cursor: pointer;
361+
}
343362
</style>

0 commit comments

Comments
 (0)