first download
npm i vue-lazyload --save-dev
然后在main.js 入口文件中配置引入
import VueLazyLoad from 'vue-lazyload'
然后配置默认加载图片
Vue.use(VueLazyLoad, {
loading: require('./images/default.png') // 加载的默认图片路径
})
Finally use v-lazy instead of :src in the .vue file to bind the image Example:
<img width="57" height="57" v-lazy="food.icon" alt="">