hilongjw / vue-lazyload

A Vue.js plugin for lazyload your Image or Component in your application.
http://hilongjw.github.io/vue-lazyload/
MIT License
7.98k stars 869 forks source link

lazyload component not working #390

Open matamune94 opened 4 years ago

matamune94 commented 4 years ago

im use nuxt my plugins

import Vue from 'vue'
import VueLazyload from 'vue-lazyload'

Vue.use({
  install () {
    Vue.prototype.destroy = Vue.prototype.$destroy
  }
})

Vue.use(VueLazyload, {
  lazyComponent: true
})

nuxt.config

  plugins: [
    { src: '~/plugins/lazyload', mode: 'client' }
  ], 

in pages

        <div v-for="item in items" :key="item" class="run col-sm-3">
        <lazy-component>
          <Product
            :item="item"
          />
        </lazy-component>
        </div>

it load all components not lazy , how can fix ?

matamune94 commented 4 years ago

nobody can help ?

aakashthapa001 commented 3 years ago

@matamune94 I am having the same issue. Did you fix it or any solutions out there to achieve this? Thanks :)

tbredin commented 3 years ago

Same issue. doesn't work. my config, loaded as a nuxt plugin: /plugins/vue-lazyload.js

import Vue from 'vue';
import VueLazyload from 'vue-lazyload';

Vue.use(VueLazyload, {
  preLoad: 1.3,
  error: '/img/loading-grey.gif',
  loading: '/img/loading-grey.gif',
  attempt: 1,
  lazyComponent: true,
  observer: true,
});

nuxt config

plugins: [
    { src: '~/plugins/vue-lazyload.js', mode: 'client' },
  ],