Skip to content

zhangzhengyang27/vue3-lazy

 
 

Repository files navigation

vue3-lazy

Status: Alpha.

Lazy load plugin for Vue 3.x inspired by vue-lazyload.

This plugin support very simple options, and easy to use.

Install

$ npm install vue3-lazy -S

Usage

main.js:

import { createApp } from 'vue'
import App from './app'
import lazyPlugin from 'vue3-lazy'

const app = createApp(App)
app.use(lazyPlugin, {
  loading: 'loading.png',
  error: 'error.png'
})
app.mount('#app')

template:

<ul>
  <li v-for="img in list">
    <img v-lazy="img.src" >
  </li>
</ul>

Lazy Options

key description default options
error src of the image upon load fail 'data-src' String
loading src of the image while loading 'data-src' String

About

Lazy load plugin for Vue 3.x

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 54.9%
  • JavaScript 24.1%
  • Vue 11.2%
  • Stylus 6.1%
  • HTML 1.9%
  • Shell 1.8%