UNPKG

vue-photoswipe

Version:
29 lines (24 loc) 672 B
import PhotoSwipeComponent from './PhotoSwipe.vue' let $vm export default { install (Vue) { const PhotoSwipe = Vue.extend(PhotoSwipeComponent) if (!$vm) { $vm = new PhotoSwipe({el: document.createElement('div')}) document.body.appendChild($vm.$el) } Vue.$photoswipe = { open (index, items, options) { $vm.open(index, items, options) }, close () { $vm.close() } } Vue.mixin({ created () { this.$photoswipe = Vue.$photoswipe } }) } }