hilongjw / vue-lazyload

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

TypeError: item.destroy is not a function #380

Open citricacid-pl opened 5 years ago

citricacid-pl commented 5 years ago

Hi, I am using vue-lazyload version: 1.3.1 and vue version: 2.6.10.

I am receiving TypeError while using <lazy-component>:

Uncaught TypeError: item.destroy is not a function
    at eval (vue-lazyload.esm.js?0177:1349)
    at Array.forEach (<anonymous>)
    at Lazy._lazyLoadHandler (vue-lazyload.esm.js?0177:1347)
    at runCallback (vue-lazyload.esm.js?0177:484)

Zrzut ekranu 2019-07-11 o 10 35 49

coleShang commented 5 years ago

me too

stefanfisk commented 5 years ago

A quick and DIRTY workaround is to do this before loading the plugin:

Vue.use({
  install() {
    Vue.prototype.destroy = Vue.prototype.$destroy;
  },
});
citricacid-pl commented 5 years ago

@stefanfisk Yes. Seems dirty. There is another solution proposed in #381 (similar to yours but not that hacky)

AmeerTaweel commented 5 years ago

A quick and DIRTY workaround is to do this before loading the plugin:

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

Thanks. This worked for me.

JensvdHeydt commented 5 years ago

@hilongjw The fix to this problem is already merged into master. Could you please make a new release, so that all these issues can get resolved?