1.index.html
<!-- 图片懒加载 -->
<script src="https://unpkg.com/vue-lazyload@1.2.6/vue-lazyload.js"></script>
2.main.js
Vue.use(VueLazyload)
Vue.use(VueLazyload, {
preLoad: 1.3,
error: '../static/image/loading.gif',
loading: '../static/image/loading.gif',
attempt: 1
})
3.使用
<ul>
<li v-for="img in list">
<img v-lazy="img.src" >
</li>
</ul>