peremp/vue-light-gallery

Filtering gallery

Closed this issue · 2 comments

Hello, i have a question regarding filtering, say, i have an array with a bunch of images and those images have tags to be filtered, something like:
gallery:[
{url:'image1.jpg',tag:'tag1'},
{url:'image2.jpg',tag:'tag2'}
]

My question is, is there a way to show only the filtered images?, if i click tag1 it displays all tag1 thumbs but when Light-Gallery is opened, it keeps showing me all the hidden images.

If im not clrea please let me know to try to explain more.

Thanks in advance (=

You have to filter the gallery before passing it to the component. Something like...

<template>
    ....
        <LightGallery
            :images="gallery.filter(image => image.tag === 'tag1')"
            ...etc
        />
   ....
</template>

Awesome thanks for the help =D