Skip to content
Advertisement

is it possible to use luminous in Vue.js?

I am trying to create photo website with vue.js and Laravel, and use luminous to magnify the photo when it is clicked. My photos are stored in AWS S3 bucket.

My vue.js structure is like below.

1.PhotoComponent.vue

  • this component is literally rendering each photo.
JavaScript

2.PhotoListComponent.vue

  • this component is making a list of PhotoComponent.vue.
JavaScript

There are three things that I have tried so far.

  1. put new Luminous() in PhotoComponent, and put the function in mounted section.
JavaScript

In this case, first picture works, but “” opens as many as PhotoComponent.vue. For example, if I make a list of 9 pictures in PhotoListComponent and click the first photo, “” opens 9 times. However, other pictures won’t work at all, but the new tab opens.

  1. put new LuminousGallery() in PhotoListComponent, and put the function in mounted section.
JavaScript

In this case, a new tab opens whenever the photo is clicked, which means that luminous does not work.

  1. not mounted, but add click event in those component.

For example…

JavaScript

In this case, the result is almost the same as pattern 1, but the first picture works perfectly as I expected. However, the other picutures won’t open anything even a new tab.

Sorry for ranting. I am stuck with this problem for a week. I really need someone’s help. Thank you for your cooperation.

Advertisement

Answer

Konnichiwa @wadakatu, Fred from @imgix here (maintainer of Luminous).

You should be able to make all of your solutions work.

For 1/ I think you need to be able to target only the image that exists within that component, so something like this could work:

JavaScript

For 2/ I think there might be an issue where the code isn’t actually finding the image elements and thus is providing nothing to the LuminousGallery call. Maybe you could try debug that to find your issue.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement