0.4.0 • Published 3 years ago

vue-image-component v0.4.0

Weekly downloads
49
License
MIT
Repository
-
Last release
3 years ago

vue-image-component

A Vue component to lazy load and display images.

Installation

npm install vue-image-component --save

Setup

// in app.js
import Vue from 'vue';
Vue.component('vue-img', require('vue-image-component'));

Usage

Here is an example with the minimum setup:

<vue-img :full="https://example.com/myImage.png"><vue-img>

This will render an image with a spinner showing up while the image is loading. Alternatively you can pass a small preview image with low quality via the preview-Property:

<vue-img full="https://example.com/myImage.png"
         preview="https://example.com/myPreviewImage.png">
<vue-img>

When passing an preview image the component uses progressive image loading. If the image is successfully loaded it will scale in.

Available properties

The following properties are available:

namerequiredtypedefaultdescription
fullxstring-The image to display.
previewstring''The image preview to use for `progressive image loading
altstring''The image alternate text.
widthstring'120px'The image width.
heightstring'auto'The image height.
spinner-sizestring'64px'The spinner size.
cssobject{}Optional css for the image container.
linkstring''A link where the image should link to.
data-src-setstring''The img data src set. Experimental
data-sizesstring''The img data sizes. Experimental
0.3.5

3 years ago

0.4.0

3 years ago

0.3.4

4 years ago

0.3.3

5 years ago

0.3.2

5 years ago

0.3.1

5 years ago

0.3.0

6 years ago

0.2.0

6 years ago

0.1.6

6 years ago

0.1.5

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago