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

response Still getting this same error on 1.3.2 #395

Open anotherso1a opened 5 years ago

anotherso1a commented 5 years ago

Still getting this same error on 1.3.2

Originally posted by @palfaro91 in https://github.com/hilongjw/vue-lazyload/pull/381#issuecomment-523226397

I use this code fixed it

Vue.prototype.destroy = Vue.prototype.$destroy
palfaro91 commented 5 years ago

@anotherso1a Where did you place did this code?

hansenbeautyspotter commented 5 years ago

@palfaro91 you put it where you usually put any Vue prototype or your main instance of Vue is being defined, if your Vue is created with CLI or the Templates usually the main instance is in main.js

palfaro91 commented 5 years ago

If I'm working with Nuxt would I place this code in the plugin file? @hansenbeautyspotter

hansenbeautyspotter commented 5 years ago

@palfaro91 yeah I think you can just add it in the plugin file since the idea of the fix is to give Vue new prototype / wrap the destroy function for the VueLazyLoad.

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

Vue.prototype.destroy = Vue.prototype.$destroy // add here

Vue.use(VueLazyload)