Vue.jsでシンプルなライトボックスを実装する「vue-pure-lightbox」
by kabanoki
HTML
<div id="app">
<vue-pure-lightbox
style="width: 20em"
thumbnail="https://placekitten.com/300/200"
:images="[
'https://placekitten.com/800/600',
'https://placekitten.com/800/601',
'https://placekitten.com/800/599',
]"
></vue-pure-lightbox>
</div>
<link rel="stylesheet" href="https://unpkg.com/vue-pure-lightbox/dist/VuePureLightbox.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.6.10/vue.min.js"></script>
<script src="https://unpkg.com/vue-pure-lightbox/dist/VuePureLightbox.umd.min.js"></script>
CSS
body {
padding: 20px;
font-family: Helvetica;
}
#app {
background: #fff;
border-radius: 4px;
padding: 20px;
transition: all 0.2s;
}
Vue
const VuePureLightbox = window['VuePureLightbox'];
new Vue({
el: '#app',
components: {
'vue-pure-lightbox': VuePureLightbox,
}
});