Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More than one instance on the same page will not work #39

Open
manjufy opened this issue May 2, 2020 · 3 comments
Open

More than one instance on the same page will not work #39

manjufy opened this issue May 2, 2020 · 3 comments

Comments

@manjufy
Copy link

manjufy commented May 2, 2020

I have to have two upload buttons in the same page.
An example would be

  • One to upload a cover image
  • Another one to upload a logo

However, If we have two instances of the Image uploader even with different ID's as recommended, uploader does not work

@svale
Copy link
Member

svale commented May 28, 2020

Thank you for the patiences, @manjufy !

I'm not able to re-created this. Adding two instances/upload buttons in the codesandbox demo seems to work as expected.

Do you have repo or code example in a codepen I could look at?

@manjufy
Copy link
Author

manjufy commented May 29, 2020

@svale Sorry for late reply. I have made it work but I forgot to keep the working codes. I'm still using the same uploader in my current project and going to give a try again and let you know how that goes. 🤞

@adityaekawade
Copy link

I also came across this issue. If you add more than one instance and pass the id props as mentioned in the docs, you see the default HTML file upload button and the custom upload button will not work. This is because the input label gets the id fileInput by default but if you pass id as a prop, this new id is assigned to the input label.

To fix this you will need to change the for attribute on the label corresponding to the id that is passed as props. For example:

<label :for="idx" slot="upload-label">
... 
</label>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants