Socket
Socket
Sign inDemoInstall

@techassi/vue-lazy-image

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@techassi/vue-lazy-image

This plugin lets you lazy load images making use of IntersectionObserver


Version published
Weekly downloads
5
increased by400%
Maintainers
1
Weekly downloads
 
Created
Source

vue-lazy-image

This plugin lets you lazy load images making use of IntersectionObserver. This plugin is Vue V3 compatible.

Planned features

  • Observe images based on class instead of unique ids (make it configurable trough options)

Usage

Installation

npm install @techassi/vue-lazy-image --save

or

yarn add @techassi/vue-lazy-image

Basic usage

main.js

import { createApp } from 'vue';
import App from './App.vue';

import VueLazyImage from '@techassi/vue-lazy-image';

createApp(App).use(VueLazyImage).mount('#app');

YourComponent.vue

<template>
    <lazy-image :src="PATH_TO_IMAGE" :id="UNIQUE_ID"></lazy-image>
</template>

Advanced usage

main.js

import { createApp } from 'vue';
import App from './App.vue';

import VueLazyImage from '@techassi/vue-lazy-image';

const intersectionObserverOptions = {};
createApp(App).use(VueLazyImage, intersectionObserverOptions).mount('#app');

YourComponent.vue

<template>
    <lazy-image
        :src="PATH_TO_IMAGE"
        :id="UNIQUE_ID"
        :use-picture="TRUE / FALSE"
        @EVENT="CALLBACK"
    ></lazy-image>
</template>

For detailed Intersection observer options see here

Available Events
  • @intersected: This event triggers when the image intersects with the viewport
  • @loaded: This event triggers when the image is loaded
  • @error: This event triggers when there was an error loading the image

Contributing / Building

Contributions and pull request are welcome!

cd vue-lazy-image
yarn install / npm install
yarn run build / npm run build

Keywords

FAQs

Package last updated on 22 Feb 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc