1.2.1 • Published 3 years ago

vue-lazy-renderer v1.2.1

Weekly downloads
23
License
MIT
Repository
github
Last release
3 years ago

vue-lazy-renderer

Lazily render Vue.js components for performance.

Feature

  • Speed. Use the Intersection Observer API (IO) to prevent performance problems.
  • Degrade Gracefully. If a user's browser doesn't support the IO, use getBoundingClientRect instead. (vue-lazy-renderer does not load the IO polyfill—it is too fat. You can load it by yourself.)
  • Lightweight. Only 3.7 kB minified.
  • Highly Customized. You can globally set several options and locally override them.

Installation

npm:

npm install vue-lazy-renderer

Yarn:

yarn add vue-lazy-renderer

Usage

Registration

Use a plugin to register a global component:

import VueLazyRenderer from 'vue-lazy-renderer';
import Vue from 'vue';

Vue.use(VueLazyRenderer);

Example

Customization

Options/Props

ParameterDescriptionTypeDefault
tagNameThe tag name of the root node of <lazy-renderer>String'div'
preLoadThe proportion of a pre-loading height or width to window.innerHeight or window.innerWidthNumber1.5
observerOptionsThe Intersection Observer optionsObject{ rootMargin: '0px 50% 50% 0px' }
listenedEventsThe events you want window to listen for (used by getBoundingClientRect)Array'scroll', 'resize', 'orientationChange'
throttledWaitThe number of milliseconds to throttle invocations toNumber100

Events

NameDescription
loadStart to load elements wrapped in <lazy-renderer>

License

MIT

1.2.1

3 years ago

1.2.0

3 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago