Socket
Socket
Sign inDemoInstall

@nuxt-modules/lazy-load

Package Overview
Dependencies
179
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @nuxt-modules/lazy-load

Lazy load module for Nuxt 3


Version published
Weekly downloads
53
decreased by-62.68%
Maintainers
1
Created
Weekly downloads
 

Changelog

Source

0.2.0 (2022-01-31)

Features

Readme

Source

@nuxt-modules/lazy-load

@nuxt-modules/lazy-load

npm version npm downloads Github Actions CI Codecov License

Lazy Loading Images module for Nuxt 3

Features

  • Nuxt 3 ready
  • Easy Lazy Loading Images, Pictures, and other HTML elements
  • Advanced configuration using Lozad.js
  • Handy composable useLazyLoad
  • TypeScript support

📖  Read the documentation

Setup

yarn add @nuxt-modules/lazy-load # yarn
npm i @nuxt-modules/lazy-load # npm

Basic usage

Firstly, you need to add @nuxt-modules/lazy-load to your Nuxt config.

// nuxt.config.js

{
  buildModules: [
    ['@nuxt-modules/lazy-load']
  ]
}

Then you can start using @nuxt-modules/lazy-load in your setup function!

<script setup lang="ts">
const { init } = useLazyLoad();

onMounted(() => {
  init()
})
</script>

Lastly, let's add a lazy class and change src attribute to data-src

<img class="lazy" data-src="https://path-to-image.jpg"/>

Development

  1. Clone this repository
  2. Install dependencies using yarn install or npm install
  3. Start development server using yarn dev or npm run dev

License

MIT License

Keywords

FAQs

Last updated on 31 Jan 2022

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc