Feb 2, 2021
0
Level 22
LightGallery.js not working on v-for
Template:
<template>
<div ref="lightgallery">
<div v-for="image in images">
<a class="lg-selector" :href="image">
<img :src="image" class="img-fluid rounded">
</a>
</div>
</div>
</template>
Script:
<script>
import 'lightgallery.js';
import 'lg-thumbnail.js';
import 'lg-fullscreen.js';
import 'lg-autoplay.js';
import 'lg-rotate.js';
import 'lg-zoom.js';
import 'lightgallery.js/dist/css/lightgallery.css';
export default {
name: "LightGallery",
props: ['images'],
mounted() {
window.lightGallery(this.$refs.lightgallery, {
download: false,
selector: '.lg-selector',
});
}
}
</script>
Please or to participate in this conversation.