initial image is showing up as "not found" with nuxt
See original GitHub issueHi
When implementing vue-lazyload
in nuxt
, I see the following result in my browser (please also refer to the picture below):
- image is “not found” as the
alt
text is shown - the loading placeholder image is shown
- the actual image is shown
Why is it that I see this first step, i.e. the image that is not being found? This is very weird behaviour and I do not manage to solve this problem.
This is my config:
lazyload.client.js
plugin:
import Vue from 'vue'
import VueLazyload from 'vue-lazyload'
import loading from '../assets/images/placeholder.png'
Vue.use(VueLazyload, {
loading
})
And I have this in my template:
<template functional>
<figure class="image is-3by2">
<img v-lazy="props.src" :alt="props.alt" />
</figure>
</template>
<script>
export default {
props: {
src: {
type: String,
required: true
},
alt: {
type: String,
required: true
}
}
}
</script>
nuxt.config.js
file excerpt:
export default {
mode: 'universal',
plugins: [
'~/plugins/lazyload.client.js'
],
...
}
````
Issue Analytics
- State:
- Created 4 years ago
- Reactions:11
- Comments:14
Top Results From Across the Web
vue.js - image not found in assets when using @error in Nuxt
Show activity on this post. Based on this you need to use require because images inside assets directory are considered as modules :...
Read more >nuxt-img
Uses built-in provider to optimize local and remote images · Converts src to provider optimized URLs · Automatically resizes images based on width...
Read more >Nuxt - The Intuitive Vue Framework
Build your next Vue.js application with confidence using Nuxt. An open source framework making web development simple and powerful.
Read more >Static directory - Nuxt
If you don't want to use Webpack assets from the assets directory, you can add the images to the static directory. In your...
Read more >Plugins directory - Nuxt
If you get an Cannot use import statement outside a module error, you may need to add your package to the build >...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@jrah No, sorry, I still have that problem…
img:not([src]) { display: none; }
this seems to work in chrome, to hide the broken images until the javascript set the src-attribute