I have vue-upload-component. I need to show uploaded images and show on every image button for upload new image. As I understood this plugin haven't method for changing uploaded file. So I think to do it manually. But I don't know how to open folder for choosing files.
How to open browse folder for new image?
</template>
<div>
<file-upload
:ref="uploaderName"
v-model="files"
:input-id="uploaderName"
:extensions="formats"
:drop="drop"
:multiple="multiple"
@input-filter="inputFilter"
>
Upload a file
</file-upload>
<span>or drag and drop</span>
</div>
<div
v-show="files.length && !loading"
class="flex"
>
<img
v-for="image in files"
:key="image.id"
:src="image.url"
:style="[imageSize]"
class="uploaded-image p-2 mr-2 border rounded border-gray-200"
>
<button @click.prevent='() => uploadNew(image)'>
Upload new
</button>
<button @click.prevent='() => removeFile(image)'>
Remove
</button>
</div>
</template>
<script>
import FileUpload from 'vue-upload-component';
export default {
name: 'UploadFileForm',
components: {
FileUpload,
},
props: {
uploaderName: {
type: String,
required: true,
default: '',
},
formats: {
type: Array,
default: () => ['.jpg', '.jpeg', '.svg', '.png', '.webp'],
},
multiple: {
type: Boolean,
default: true,
},
drop: {
type: Boolean,
default: true,
},
imageWidth: {
type: Number,
},
imageHeight: {
type: Number,
},
value: {
type: Array,
default: () => {},
},
},
data() {
return {
files: this.value || [],
error: '',
loading: false,
hover: false,
minImageWidth: 372,
minImageHeight: 300,
};
},
methods: {
removeFile(file) {
this.$refs[this.uploaderName].remove(file);
},
uploadNew() {
}
};
</script>
this.$refs.[yourInputFileName].click()?