# vue-lazy

> Lazyloading based on Intersection Observer API

Latest version **0.2.4** (published 2020-09-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install vue-lazy
pnpm add vue-lazy
yarn add vue-lazy
bun add vue-lazy
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.4 |
| Published | 2020-09-03 |
| First published | 2020-06-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=12.13.0 <13.0.0 |
| Dependencies | 2 |
| Unpacked size | 35.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | smugers@gmail.com |
| Maintainers | smugers |
| Keywords | vue, vue-lazy, lazy, image, picture |

## Links

- npm: https://www.npmjs.com/package/vue-lazy
- Repository: https://github.com/bartdominiak/vue-lazy
- Homepage: https://github.com/bartdominiak/vue-lazy#README
- Issues: https://github.com/bartdominiak/vue-lazy/issues
- npm.io page: https://npm.io/package/vue-lazy

## Dependencies (2)

- [core-js](https://npm.io/package/core-js.md) ^3.6.5
- [intersection-observer](https://npm.io/package/intersection-observer.md) ^0.11.0

## Alternatives

- [exif-parser](https://npm.io/package/exif-parser.md) — 3.8M weekly downloads
- [vite-plugin-compression](https://npm.io/package/vite-plugin-compression.md) — 569.5K weekly downloads
- [pica](https://npm.io/package/pica.md) — 442.4K weekly downloads
- [@reportportal/client-javascript](https://npm.io/package/@reportportal/client-javascript.md) — 408.8K weekly downloads
- [@tldraw/state](https://npm.io/package/@tldraw/state.md) — 316.0K weekly downloads

## Recent versions

- 0.2.4 (latest) — 2020-09-03
- 0.3.0 (0.3.0) — 2020-09-24
- 0.2.3 — 2020-08-31
- 0.2.2 — 2020-08-29
- 0.2.1 — 2020-08-29
- 0.2.0 — 2020-08-29
- 0.1.0-alpha.1 — 2020-06-17

## README

[![npm version](https://badge.fury.io/js/vue-lazy.svg)](https://badge.fury.io/js/vue-lazy)
![npm bundle size](https://img.shields.io/bundlephobia/minzip/vue-lazy)
[![license](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/bartdominiak/vue-lazy/blob/master/LICENSE.md)

# vue-lazy
> Lightweight Image/Picture lazyload based on Intersection API.

## About
Please note that this lib is on very early stage.

## Storybook
- 📕 [Stories](https://vue-lazy.vercel.app)
- 📺 [Props/Event](https://vue-lazy.vercel.app/?path=/story/image-docs--page)

## Benefits
- Lightweight
- Picture tag support

## Usage
There are two ways to use it.

### Globally

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

Vue.use(VueLazy)
```

### Locally

```js
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
```html
<lazy-image
  src="https://via.placeholder.com/250"
  alt="example aternative text"
/>
```

### Image with known width (prevent jumping content on page)
```html
<lazy-image
  src="https://via.placeholder.com/250"
  alt="example aternative text"
  width="250"
  height="250"
/>
```

### Picture
```html
<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.

---
_Source: https://npm.io/package/vue-lazy · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
