rowanwins / vue-dropzone

A Vue.js component for Dropzone.js - a drag’n’drop file uploads utility with image previews
https://rowanwins.github.io/vue-dropzone/docs/dist
MIT License
2.02k stars 1.4k forks source link

seems we can't have more than one instance of the component #25

Closed estrica2000 closed 7 years ago

estrica2000 commented 7 years ago

Uncaught Error: Dropzone already attached. at new t (eval at

Is it possible to change this? Many thanks

rowanwins commented 7 years ago

I've just tested and having it twice is fine, just make sure each instance has a unique id

So for example

    <dropzone id="myVueDropzone" url="https://httpbin.org/post"></dropzone>
    <dropzone id="myVueDropzone2" url="https://httpbin.org/post"></dropzone>

Reopen the issue if you continue to run in to problems

estrica2000 commented 7 years ago

thank you!

thijs95 commented 7 years ago

@rowanwins Hi,

This is exactly what I need, but I add the component in a button click event.

I have a parent component that has an array of a child component. That child component uses the dropzone. In my parent I start with 0 child components, and I append the child component in the button click event. When I add the first instance of the child component the dropzone is also added, but when I add the second instance the id obviously stays the same. At that moment i get this error: [Vue warn]: Error in mounted hook: "Error: Dropzone already attached." Do you have any idea how I can change the id of the dropzone at the moment I add the child component? I've seached for an answer but I can't find anything specific for my problem.

rowanwins commented 7 years ago

Hi @thijs95

Can you post a snippet of your current setup.

Thanks

thijs95 commented 7 years ago

Here u go

Parent Template Parent script Child Template Child Script Thanks for the reply