Vue Picture Swipe Gallery is a Vue 2.x component that provides a mobile-friendly image gallery with swipe functionality, lazy loading, and thumbnail previews. It acts as a lightweight wrapper around the popular PhotoSwipe library, abstracting away its complexities for easier integration into Vue applications. The current stable version, 2.1.0, was released in March 2020 and primarily targets Vue 2 environments. The package differentiates itself by offering out-of-the-box thumbnail support and swipe gestures, addressing a common need for responsive image galleries that some other Vue wrappers or standalone PhotoSwipe integrations might not directly provide without additional configuration. It does not actively receive new feature updates and is not compatible with Vue 3.
npm install vue-picture-swipeVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to integrate `vue-picture-swipe` into a Vue 2.x Single File Component (SFC), providing a basic image gallery with placeholder images and thumbnails.
For Vue 3 projects, consider using `vue3-picture-swipe` (a separate package) or another PhotoSwipe wrapper specifically designed for Vue 3, or continue using Vue 2 if migrating is not an option.
Refer to the official PhotoSwipe documentation for a comprehensive list of available options and their expected types. Ensure the object passed to the `options` prop conforms to the PhotoSwipe API.
Ensure the component is mounted before attempting to access `$refs.pictureSwipe.pswp`. Wrap calls in `this.$nextTick()` or lifecycle hooks like `mounted()`.
Globally: `import VuePictureSwipe from 'vue-picture-swipe'; Vue.component('vue-picture-swipe', VuePictureSwipe);`. Locally: import `VuePictureSwipe` into your component's script section and add it to the `components` option: `components: { VuePictureSwipe }`.Ensure the `<vue-picture-swipe ref="pictureSwipe"></vue-picture-swipe>` element has the correct `ref` attribute. Access the `pswp` property only after the component is mounted, typically within `mounted()` or after `this.$nextTick()` for DOM updates.