Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

vue-lazy

bartdominiak46MIT0.2.4

Lazyloading based on Intersection Observer API

vue, vue-lazy, lazy, image, picture

readme

npm version npm bundle size license

vue-lazy

Lightweight Image/Picture lazyload based on Intersection API.

About

Please note that this lib is on very early stage.

Storybook

Benefits

  • Lightweight
  • Picture tag support

Usage

There are two ways to use it.

Globally

import Vue from 'vue'
import VueLazy from 'vue-lazy'
import 'vue-lazy/dist/vue-lazy.css'

Vue.use(VueLazy)

Locally

import { LazyImage } from 'vue-lazy'
import 'vue-lazy/dist/vue-lazy.css'

export default {
  components: {
    LazyImage
  }
}

Examples

If you want to see live examples, please jump to Storybook page.

Image

<lazy-image
  src="https://via.placeholder.com/250"
  alt="example aternative text"
/>

Image with known width (prevent jumping content on page)

<lazy-image
  src="https://via.placeholder.com/250"
  alt="example aternative text"
  width="250"
  height="250"
/>

Picture

<lazy-image
  src="https://via.placeholder.com/250"
  alt="example aternative text"
  tag="picture"
>
  <source media="(min-width:1366px)" srcset="https://via.placeholder.com/1360x300">
  <source media="(min-width:1024px)" srcset="https://via.placeholder.com/1024x300">
</lazy-image>

Contribution

Feel free to grab an issue from the list, just remember to squash your commits before merge.

changelog

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

[Unreleased]

[0.2.4] - 2020-09-03

Fixed

  • Loading state for Picture tag

[0.2.3] - 2020-08-31

Updated

  • Moved picture tag as a integral part of LazyImage Component

[0.2.2] - 2020-08-29

Added

  • Core-js

[0.2.1] - 2020-08-29

Updated

  • Animation type and time

[0.2.0] - 2020-08-29

Added

  • LazyImage component
  • example stories

Updated

  • Folder structure
  • Dependancies
  • Readme

[0.1.0-alpha.1] - 2020-06-17

Added

  • init