-
Notifications
You must be signed in to change notification settings - Fork 273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: support placeholder #477
Conversation
src/runtime/components/nuxt-img.vue
Outdated
created () { | ||
mounted () { | ||
if (this.placeholder) { | ||
this.image = this.placeholder |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a nice start but also means on initial hydration, actual images only start loading when the whole JS bundle is loaded and hydration happens. We can enhance it later with a head script doing the same and hydrating from a data-
attribute.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose hydrating from a data
atrribute would make a great addition for lazy loading images.
Codecov Report
@@ Coverage Diff @@
## main #477 +/- ##
==========================================
- Coverage 58.95% 58.55% -0.41%
==========================================
Files 34 34
Lines 709 719 +10
Branches 236 238 +2
==========================================
+ Hits 418 421 +3
- Misses 284 291 +7
Partials 7 7
Continue to review full report at Codecov.
|
Thanks for working on this. I've pushed few improvements to directly use |
Co-authored-by: Pooya Parsa <[email protected]>
A starting point to resolve #189
Example added on the playground app.
Suggestions and/or contributions by fellow Nuxters would be appreciated!