pic.400px.jpg
or pic.200px.jpg
, let you switch resolution of images by some custom rules.npm install vue-lazyload-img@1
a plugin of vue for image lazyload, especially optimized for mobile browser
Use mobile mode if possible
Vue.use(Lazyload[,options])
global options
0 (defult 0): average changes of document y-pos and any scroller's x-pos from last 10 frames
Vue.use(Lazyload,{
// default false, recommand true
fade: true,
// it's better not set the speed now (because cellphones perfomance is better)
// this option make images show slower
// but if you open it, it does save network traffic data
// speed: 20,
// default 300, mostly, it's not necessary to set it
time: 300,
// unit:px, default 0, it allows the lazyload manager loads images(vertical) before an image appeard in screen
preload: 500,
})
npm install vue-lazyload-img
es6
import Lazyload from "vue-lazyload-img"
Vue.use(Lazyload)
es5
var Lazyload = require("vue-lazyload-img")
Vue.use(Lazyload)
in this way, you'll need babel
or something like it
because this plugins supports umd
, so you can use it as a <script>
or with JS module loader like require.js
.
the released bundle is in:
dist/vue.lazyimg.min.js
dist/vue.lazyimg.js
pic.400px.jpg
or pic.200px.jpg
, let you switch resolution of images by some custom rules.npm install vue-lazyload-img@1
a plugin of vue for image lazyload, especially optimized for mobile browser
Use mobile mode if possible
Vue.use(Lazyload[,options])
global options
Vue.use(Lazyload,{
// default false, recommand true
fade: true,
// it's better not set the speed now (because cellphones perfomance is better)
// this option make images show slower
// but if you open it, it does save network traffic data
// speed: 20,
// default 300, mostly, it's not necessary to set it
time: 300,
// unit:px, default 0, it allows the lazyload manager loads images(vertical) before an image appeard in screen
preload: 500,
})
npm install vue-lazyload-img
es6
import Lazyload from "vue-lazyload-img"
Vue.use(Lazyload)
es5
var Lazyload = require("vue-lazyload-img")
Vue.use(Lazyload)
in this way, you'll need babel
or something like it
because this plugins supports umd
, so you can use it as a <script>
or with JS module loader like require.js
.
the released bundle is in:
dist/vue.lazyimg.min.js
dist/vue.lazyimg.js