I have a page (in Laravel) where I"m using Vue for the overall function of the page and the ultimate axios post for form submission, but I've run into a tricky situation.
I have a standard dropzone (using the plain JS dropzone code) where I'm dropping images for upload. When I drop the image, I have the console logging the file name, which is working perfectly fine. The issue is that I need to take that filename and push it into a variable, object in my vue code.
The dropzone code is like so:
Dropzone.options.imageWithZones = {
init: function() {
this.on("addedfile",
function(file) {
console.log(file.name);
});
}
};
But my vue code is here, and I need to set ImageZoneName with the file name from the previous function
new Vue({
components: {
Multiselect: window.VueMultiselect.default
},
el: "#commonDiv",
data() {
return{
ImageZoneName: [],
}
},
........
What is the best way to simply take the file name (when a file is added to dropzone) and set the vue ImageZoneName object to ahve a value of that file name?
mounted, and then in the dropzone function set the vue variable. - Steven B.