npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vue-l-lazyload

v1.1.1

Published

A lazyload and in-view detection plugin for Vue.js v2.x+.

Downloads

46

Readme

vue-l-lazyload

A lazyload and in-view detection plugin for Vue.js v2.x+.

Demo

Live demo or npm install vue-l-lazyload && npm run startDev to play it!

Pull requests are welcome :)

Build Status Coverage

License

LGPL-V3 License: LGPL v3

Features

  • No extra dependencies except Vue
  • Progressive configuration
  • Flexible events to trigger loading
  • Lazyload as src attribute and background image are supported
  • Customized retry control
  • Filters for substitution of url by rules
  • Performance boost by event delegation and passive event listener when it's available
  • LazyComp for lazy loading child component.
  • InViewComp for in-view detection

Installation

vue-l-lazyload

npm install vue-l-lazyload

Usage

A simple way:

import { VueLLazyload } from 'vue-l-lazyload';
// For smaller production code with tree shaking, I recommend you to import the src instead:
// import { VueLLazyloadLocal: VueLLazyload } from 'vue-l-lazyload/src';
Vue.use(VueLLazyload, {
	events: 'scroll'
});
// The root $lazy "Vue.$lazy" will be available after it's been installed
<img lazy="xxx.png">

A more configurable way:

import { VueLLazyload } from 'vue-l-lazyload';
Vue.use(VueLLazyload, config);
<lazy-ref ref="lazyRef" opts="config">
    <img lazy="{src:xxx.png, ref:'lazyRef'}">
</lazy-ref>

Vue Plugins

VueLLazyload

Vue Plugin with global option of registering directive "lazy" and component "lazy-ref".

VueLLazyloadLocal

Vue Plugin without global option of registering directives or components for local usage purpose and smaller footprint.

Config

Notes about Config

Note that ALL ANCESTORS' CONFIGS WILL BE INHERITED level by level. So be careful there may be conflict problems if you use too many ancestors' configs!

Available Config Table

[1]: All options will inherit its ancestors' options.

LazyLoader

$lazy is Instance of LazyLoader, available for LazyRef and InViewComp.

Methods

Directives

Lazy(v-lazy)

value

Extra config for the Value of Lazy

[1]: All options should not be changed after they have initialized except for [2]. [2]: It will mark the node not loaded and load again when it's in parent view. if once is set to false. [3]: All options will inherit its ancestors' options.

Components

LazyRef(lazy-ref, Experimental)

InViewComp

Extra config for opts InViewComp

[1]: All options above won't inherit its ancestors' options by now.

LazyComp

Props

Extra config for opts LazyComp

[1]: All options above won't inherit its ancestors' options by now.

Slots

Well, what's next?

  • More abilities
  • More test cases
  • Performance optimization