Control slide number
To open the gallery on a different slide than the first, specify the desired slide by using one of the two props: "slide" (integer) or "sourceIndex" (integer, slide number minus one).
<template>
<div>
<button @click="openLightboxOnSlide(1)">
Open the lightbox on the first slide.
</button>
<button @click="openLightboxOnSlide(2)">
Open the lightbox on the second slide.
</button>
<FsLightbox
:toggler="toggler"
:slide="slide"
:sources="[
"/Images/1.jpg",
"/Images/2.jpg"
]"
/>
</div>
</template>
<script>
import FsLightbox from "fslightbox-vue";
export default {
components: { FsLightbox },
data() {
return {
toggler: false,
slide: 1
}
},
methods: {
openLightboxOnSlide: function(number) {
this.slide = number;
this.toggler = !this.toggler;
}
}
}
</script>In the above example, there is presented a usage of the "slide" prop. The other prop—"sourceIndex"—is used analogously.