vue-lazy-background-images
vue-lazy-background-images copied to clipboard
Error on npm run dev
After installing and importing :
import Vue from 'vue'
import App from './App'
import VueLazyBackgroundImages from 'vue-lazy-background-images'
Vue.component('lazy-background', VueLazyBackgroundImages)
I get the following error
I managed to fix this by changing "main": "main.js"
to "main": "VueLazyBackgroundImage.vue"
in package.json.
Are you using vue2?
Yes, vue-cli project webpack template
I see.
By the looks of things you're trying to import VueLazyBackgroundImages
and it's actually called VueLazyBackgroundImage
without the s
at the end.
This totally conflicts with the documentation, so very valid, will fix it.
Okay I am stuck, don't know where to put all things together, i'm new to Vue 2. Do i put this in App.vue? <lazy-background // binding :image-source="backgroundImage" :loading-image="loadingImage" // direct link or path error-image="/img/error.png" image-class="img-responsive" >
This is my VueLazyBackground.vue file.
instead: import VueLazyBackgroundImages from 'vue-lazy-background-images'
use: import VueLazyBackgroundImage from 'vue-lazy-background-images/VueLazyBackgroundImage'
solved for me!
Thanks @waLplanet , that worked for me. Strange that it doesnt match the docs @darrynten
`import VueLazyBackgroundImage from 'vue-lazy-background-images/VueLazyBackgroundImage'
export default { components: { countdownTimer, VueLazyBackgroundImage },`
Don't use
import VueLazyBackgroundImage from 'vue-lazy-background-images
Instead of that use like this
import VueLazyBackgroundImage from 'vue-lazy-background-images/VueLazyBackgroundImage'