+++ /dev/null
-<template>
- <div class="product-gallery" v-show="images.length > 0">
- <div class="product-gallery-main">
- <div class="product-gallery-main-image cursor-zoom-in" :style="`background-image:url(${thumbnails[currentImage]})`" @click="lightboxImage = currentImage"></div>
- </div>
- <div class="grid grid-cols-3 grid-gap-sm" v-show="images.length > 1">
- <div v-for="(thumb, i) in thumbnails"
- :key="i"
- :style="`background-image:url(${thumb})`"
- :class="{ 'product-gallery-current' : currentImage === i }"
- class="product-gallery-thumb cursor-zoom-in"
- @click="lightboxImage = i"
- >
- </div>
- </div>
- <!-- Options reference: https://github.com/blueimp/Gallery#options -->
- <lightbox-gallery
- :options="{ closeOnSlideClick: true }"
- :images="images"
- :index="lightboxImage"
- @close="lightboxImage = null"
- >
- <template v-slot:close>×</template>
- <template v-slot:next>
- <svg xmlns="http://www.w3.org/2000/svg" width="38.414" height="26" viewBox="0 0 38.414 26"><g fill="none" stroke="#fff" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2"><path d="M25 1l12 12-12 12"/><path d="M37.001 13H1"/></g></svg>
- </template>
- <template v-slot:prev>
- <svg xmlns="http://www.w3.org/2000/svg" width="38.414" height="26" viewBox="0 0 38.414 26"><g fill="none" stroke="#fff" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2"><path d="M13.414 25l-12-12 12-12"/><path d="M1.413 13h36.001"/></g></svg>
- </template>
- </lightbox-gallery>
- </div>
-</template>
-
-<script>
- import VueGallery from 'vue-gallery';
-
- export default {
-
- components: {
- 'lightbox-gallery': VueGallery
- },
-
- props: {
- images: {
- type: Array,
- required: true,
- },
- thumbnails: {
- type: Array
- }
- },
- data: () => ({
- currentImage: 0,
- lightboxImage: null,
- }),
-
- computed: {
-
- },
-
- created() {
- // Fallback to using images if thumbnails not passed
- this.thumbnails = this.thumbnails || this.images;
- },
-
- mounted() {
-
- },
-
- methods: {
-
- selectImage(imageIndex, event) {
- this.currentImage = imageIndex;
- },
- },
-
- }
-</script>
-
-<style lang="stylus">
- .blueimp-gallery
- > .next, > .prev
- background: transparent
- border: none
- border-radius: unset
-</style>