The `vue-blurhash` package provides a set of Vue 2 components designed to implement Blurhash image placeholders. It allows developers to display a compact, low-resolution representation of an image while the full-resolution image loads, enhancing the perceived performance and user experience of web applications. The library offers two primary components: `<blur-hash-image>` for a complete image loading solution including an optional fade transition, and `<blur-hash-canvas>` for generating only the Blurhash placeholder on a canvas, enabling custom image loading logic. As of its current stable version 0.1.4, it specifically targets Vue.js 2.0+ environments. Its release cadence appears infrequent, typical for a specialized utility library tied to an older major framework version. A key differentiator is its straightforward integration as a Vue plugin, simplifying the process of adding Blurhash functionality without extensive manual implementation of the `blurhash` algorithm itself.
npm install vue-blurhashVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to register `vue-blurhash` as a Vue 2 plugin, import its necessary CSS, and then utilize both the `<blur-hash-image>` component for a complete image loading experience and the `<blur-hash-canvas>` for just displaying the blurhash placeholder.
For Vue 3, consider using a different Blurhash library or implementing the functionality manually tailored for Vue 3's composition API or component structure.
Ensure you install the `blurhash` package in your project using `npm install blurhash` or `yarn add blurhash`.
Add `import 'vue-blurhash/dist/vue-blurhash.css'` to your application's entry point or a relevant component file where the styles are needed.
Add `Vue.use(VueBlurHash)` to your application's entry point before creating your main Vue instance.
Install the `blurhash` package: `npm install blurhash` or `yarn add blurhash`.
Add `import 'vue-blurhash/dist/vue-blurhash.css'` to your application's main JavaScript file or a suitable style entry point.