vue-blurhash

Blurash Vue components
19,688 52
Install
npm install vue-blurhash
Latest Version:0.1.4
Vue:2
License:MIT
Last Updated:Dec 12, 2022
Links: GitHub  ·  npm
Maintainer: damienroche

vue-blurhash

VueJS components using the blurhash algorithm

Installation

You need Vue.js version 2.0+

Install via npm

npm install vue-blurhash
yarn add vue-blurhash

Import and use

import Vue from 'vue'
import VueBlurHash from 'vue-blurhash'

// Import css if you want to use image fade transition
import 'vue-blurhash/dist/vue-blurhash.css'

...

Vue.use(VueBlurHash)
<template>
  <blur-hash-image
    width="400"
    height="300"
    hash="LdHfL}oJR$WBKnfi%3ofT0kCM{ay"
    src="https://images.unsplash.com/photo-1545910684-8e7c081be9b0?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1867&q=80"
    alt="green lawn grass during daytime"
  />
</template>

Props

Name Type Default Description
height [Number, String] 128 Height of image
width [Number, String] 128 Width of image
punch [Number, String] 1 This value adjusts the contrast on the decoded image
src String null Image source url
srcset String null Image sourceset attribute
transitionDuration Number 500 Fade animation - Transition time (in ms)

Use Canvas only

Maybe you want to only draw the placeholder from the hash and implementing your own image displaying logic. You can do this from this way

import { BlurHashCanvas } from "vue-blurhash";
<template>
  <blur-hash-canvas
    :hash="hash"
    :width="width"
    :height="height"
    :punch="punch"
  />
</template>

Related Packages

v-preview-image

一个基于vue3的图片预览插件,可以缩放图片,移动图片,旋转图片,目前只支持pc端。

3,455
vue-img-tag

A simple vue2 component, just for img preview, can be used to file input preview...

1,310 4
@dullar/mercury

Advanced and highly reusable Mobile UI Components built on Vue2 & You can define...

8,553 6
@halobear/vue-upload

vue上传组件

460 1

Version History

Version Released License
0.1.4 MIT
0.1.3 MIT
0.1.2 MIT
0.1.1 MIT
0.1.0 MIT