So we could create a thumbnail mechanism easier if the init method could be call once without opening the gallery modal.
VueJS Template:
<div v-for="(item, index) in value">
<a v-on:click="swipe(index)" v-if="item.thumb">
<img :src="item.thumb" :class="classes"/>
</a>
</div>`
Mounted method (called once):
mounted: function () {
let pswpElement = document.querySelectorAll('.pswp')[0]
let options = {
history: false,
focus: false,
showAnimationDuration: 0,
hideAnimationDuration: 0
}
this.gallery = new PhotoSwipe(pswpElement, PhotoSwipeUIDefault, this.value, options)
this.gallery.init()
},
Swipe Method:
swipe: function (index = 0) {
this.gallery.goTo(index)
}
I am also having the same issue, the init() method should not open the gallary
Most helpful comment
I am also having the same issue, the
init()method should not open the gallary