vue-preview

A Vue integration PhotoSwipe image preview plugin
20,276 637
Install
npm install vue-preview
Latest Version:1.1.3
Vue:2
License:MIT
Last Updated:Apr 23, 2019
Links: GitHub  ·  npm
Maintainer: liu-song

Vue preview plugin

一 A Vue Integrated PhotoSwipe Image Preview Plugin

Requirements

PhotoSwipe

Demo

Live Demo >>

Installation

npm i vue-preview -S

Usage

Notice:

  • This plugin currently support vue2.5 and above

Install plugin

import VuePreview from 'vue-preview'

// defalut install
Vue.use(VuePreview)

// with parameters install
Vue.use(preview, {
  mainClass: 'pswp--minimal--dark',
  barsSize: {top: 0, bottom: 0},
  captionEl: false,
  fullscreenEl: false,
  shareEl: false,
  bgOpacity: 0.85,
  tapToClose: true,
  tapToToggleControls: false
})

Examples

<template>
  <vue-preview :slides="slide1" @close="handleClose"></vue-preview>
</template>

<script>
export default {
    data () {
      return {
        slide1: [
          {
            src: 'https://farm6.staticflickr.com/5591/15008867125_68a8ed88cc_b.jpg',
            msrc: 'https://farm6.staticflickr.com/5591/15008867125_68a8ed88cc_m.jpg',
            alt: 'picture1',
            title: 'Image Caption 1',
            w: 600,
            h: 400
          },
          {
            src: 'https://farm4.staticflickr.com/3902/14985871946_86abb8c56f_b.jpg',
            msrc: 'https://farm4.staticflickr.com/3902/14985871946_86abb8c56f_m.jpg',
            alt: 'picture2',
            title: 'Image Caption 2',
            w: 1200,
            h: 900
          }
        ]
      }
    },
    methods: {
      handleClose () {
        console.log('close event')
      }
    }
  }
</script>

Prop

slide item options
Property Description
src main (large) image
msrc small image
alt image replacement text
w image width
h image height

Events

Event name Description parameter
close close gallery nothing

License

MIT Copyright (c) 2018 liusong

Related Packages

vue2-preview

A Vue2 image preview plugin

1,792 23
vue-photoswipe-directive

An image previewer for vue, powered by PhotoSwipe.

1,545 18
v-img

Vuejs plugin for image viewing

61,736 406
v-photoswipe

Vue plugin for image preview base on PhotoSwipe

126,862 32
vue3-picture-swipe

A Vue 3 integration PhotoSwipe image plugin

218,744 39

Version History

Version Released Vue License
1.1.3 ^2.5.13 MIT
1.1.2 ^2.5.13 MIT
1.1.1 ^2.5.13 MIT
1.1.0 ^2.5.13 MIT
1.0.5 ^2.0.1 MIT