Open uchoasvinicius opened 4 years ago
I think that this component is kinda encapsulated in the way it's created, I don't think it has customization support.
A bit dirty, but I'm doing this following way:
import PhotoSwipe from 'photoswipe/dist/photoswipe';
import * as DefaultPhotoSwipeUI from 'photoswipe/dist/photoswipe-ui-default';
methods: {
openGallery() {
const pswpElement = document.querySelectorAll('.pswp')[0];
const gallery = new PhotoSwipe(pswpElement, DefaultPhotoSwipeUI,
this.images,
{
captionEl: false,
shareEl: false,
});
gallery.init();
},
}
Where this.images is the array containing the images passed down to PhotoSwipe.
I searched the documentation and implementation itself, but found nothing similar to opening a gallery via @click or via a function called outside the component itself.