(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
Description:
Example:
Description: The default image that fails to be loaded.
Example: error: 'dist/error.png ',
Description: The default image settings displayed during image loading.
Example: loading: 'dist/loading.gif ',
Description:
Example:
Description: The event to listen to. The default value is ['scroll ', 'wheel', 'mousewheel', 'resize', 'animationend', 'transitionend', 'touchmove'].
Example: listenEvents: ['scroll ']
Description:
Example:
Description: Path of the image to be filtered. The default value is {}
Example:
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