Vue Progressive Image Loading

5.0.6 · active · verified Sun Apr 19

The `vue-progressive-image` package provides a plugin for Vue 3 applications, enabling efficient progressive image loading and lazy loading. This approach enhances perceived performance by displaying a low-resolution placeholder that smoothly transitions to the full-resolution image once it has completely loaded. The current stable version, 5.0.6, released in October 2025, indicates active development and maintenance with regular bug fixes. Key differentiators include its deep integration with Vue 3's component and plugin architecture, comprehensive TypeScript support since v5.0.0, and a straightforward API for managing image loading states. The library requires Vue `^3.5.13` as a peer dependency, ensuring compatibility with modern Vue applications and tooling. It focuses on delivering a robust, performant solution for image optimization without complex configuration.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to globally register the `vue-progressive-image` plugin in a Vue 3 application, including optional configuration parameters. It then shows the basic usage of the `<ProgressiveImage>` component within a template, configured with placeholder and full-resolution image URLs for progressive loading within a scrollable container.

import { createApp } from 'vue';
import App from './App.vue';
import ProgressiveImage from 'vue-progressive-image';
import 'vue-progressive-image/dist/style.css'; // Import base styles if provided by the library

const app = createApp(App);

// Register the plugin globally with optional default configurations
app.use(ProgressiveImage, {
  delay: 300, // Time in ms before the high-res image starts loading after intersection
  threshold: 0.2 // Intersection Observer threshold
});

app.mount('#app');

// --- App.vue ---
// <template>
//   <div>
//     <h1>Product Gallery</h1>
//     <div style="height: 500px; overflow-y: auto; padding: 20px; border: 1px solid #eee;">
//       <ProgressiveImage
//         src="https://picsum.photos/seed/gallery1/1200/800"
//         placeholder="https://picsum.photos/seed/gallery1/60/40"
//         alt="A serene landscape with mountains and lake"
//         style="width: 100%; max-width: 600px; display: block; margin-bottom: 30px; border-radius: 8px; box-shadow: 0 4px 8px rgba(0,0,0,0.1);"
//       />
//       <ProgressiveImage
//         src="https://picsum.photos/seed/gallery2/1000/700"
//         placeholder="https://picsum.photos/seed/gallery2/50/35"
//         alt="City skyline at sunset with vibrant colors"
//         style="width: 100%; max-width: 600px; display: block; margin-bottom: 30px; border-radius: 8px; box-shadow: 0 4px 8px rgba(0,0,0,0.1);"
//       />
//       <ProgressiveImage
//         src="https://picsum.photos/seed/gallery3/900/1200"
//         placeholder="https://picsum.photos/seed/gallery3/45/60"
//         alt="Close-up of a blooming flower with dew drops"
//         style="width: 100%; max-width: 400px; display: block; margin-bottom: 30px; border-radius: 8px; box-shadow: 0 4px 8px rgba(0,0,0,0.1);"
//       />
//     </div>
//   </div>
// </template>

// <script setup lang="ts">
// // No explicit component import needed in script setup if registered globally
// </script>

view raw JSON →