I'm using vue-dropzone
component. And I want to add custom button on file preview. I take preview element by ref. And I can change styling or anything else. But when I add <button>New Button</button>
then it came as string not an html button. How can I achieve this. You can reproduce from below codesandbox link.
How can I achieve this? If I can achieve this, then I will add onClick event that button.
<template>
<div>
<vue-dropzone ref="myVueDropzone" id="dropzone" :options="dropzoneOptions"></vue-dropzone>
</div>
</template>
<script>
import vue2Dropzone from "vue2-dropzone";
import "vue2-dropzone/dist/vue2Dropzone.min.css";
export default {
name: "App",
components: {
vueDropzone: vue2Dropzone
},
mounted: function() {
try {
let mockFile = { name: "testfile.jpeg", size: 111 };
this.$refs.myVueDropzone.manuallyAddFile(mockFile, "");
} catch (err) {}
const myElement = this.$refs.myVueDropzone.$el.querySelector(".dz-details");
myElement.append("<button>New Button</button>");
},
data: function() {
return {
dropzoneOptions: {
url: "https://httpbin.org/post",
addRemoveLinks: true,
dictRemoveFile: "Remove"
}
};
}
};
</script>
<style>
</style>
You could create the button using javascript as below: