(Production) vue-lazyload, production vue-lazyload

Source: Internet
Author: User

(Production) vue-lazyload, production vue-lazyload

Reference: https://www.npmjs.com/package/vue-lazyload

 

CDN

 https://unpkg.com/vue-lazyload/vue-lazyload.js

 

Usage

import Vue from 'vue'
import VueLazyload from 'vue-lazyload'
Vue.use(VueLazyload, {
  preLoad: 1.3,
  error: 'dist/error.png',
  loading: 'dist/loading.gif',
  attempt: 1
})

 

Options
Parameter description
 
 
  • PreLoad

Description:

Example:

  • Error

Description: The default image that fails to be loaded.

Example: error: 'dist/error.png ',

  • Loading

Description: The default image settings displayed during image loading.

Example: loading: 'dist/loading.gif ',

  • Attempt

Description:

Example:

  • ListenEvents

Description: The event to listen to. The default value is ['scroll ', 'wheel', 'mousewheel', 'resize', 'animationend', 'transitionend', 'touchmove'].

Example: listenEvents: ['scroll ']

  • Adapter

Description:

Example:

  • Filter

Description: Path of the image to be filtered. The default value is {}

Example:

  • LazyComponent

Description:

Example:

 

 

Practical examples
 
 
  • Add the following in the main. js file:

Import VueLazyload from 'vue-lazyload'

Vue. use (VueLazyload ,{

// Set the default image
Loading: require ('common/image/default.png ')
})

  • Latency loading page is required

 

 

 

 

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.