All Projects → ustbhuangyi → vue3-lazy

ustbhuangyi / vue3-lazy

Licence: MIT License
Lazy load plugin for Vue 3.x

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language
Vue
7211 projects
stylus
462 projects
HTML
75241 projects
shell
77523 projects

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
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].