App.vue
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | <template>   <div>     <button @click="showSingle">Show Single Picture</button>     <button @click="showMultiple">Show Multiple Pictures</button>     <vue-easy-lightbox       :visible="visibleRef"       :imgs="imgsRef"       :index="indexRef"       @hide="onHide"     />   </div> </template> <script> import VueEasyLightbox from 'vue-easy-lightbox' import { ref, defineComponent } from 'vue' import img1 from './assets/1.jpeg' import img2 from './assets/2.jpeg' export default defineComponent({   components: {     VueEasyLightbox   },   setup() {     const visibleRef = ref(false)     const indexRef = ref(0)     const imgsRef = ref([])     const onShow = () => {       visibleRef.value = true     }     const showSingle = () => {       imgsRef.value = 'https://via.placeholder.com/350x150'       onShow()     }     const showMultiple = () => {       imgsRef.value = [         img1,         img2       ]       indexRef.value = 0 // Starting image       onShow()     }     const onHide = () => {       visibleRef.value = false     }     return {       visibleRef,       indexRef,       imgsRef,       showSingle,       showMultiple,       onHide     }   } }) </script> <style scoped> button {   margin: 10px; } </style> |