Skip to content
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

[Avatar] Support NuxtImg #1577

Closed
maximepvrt opened this issue Mar 27, 2024 · 7 comments · May be fixed by SamandarTemirxodjayev/goshtbor#26, SamandarTemirxodjayev/goshtbor#28 or SamandarTemirxodjayev/goshtbor#29
Labels
enhancement New feature or request

Comments

@maximepvrt
Copy link
Contributor

maximepvrt commented Mar 27, 2024

Description

Currently all images element are <img> and it's possible to replace all with <NuxtImg> (@nuxt/image)

Additional context

No response

@maximepvrt maximepvrt added the enhancement New feature or request label Mar 27, 2024
@moshetanzer
Copy link
Collaborator

Hi @maximepvrt ,

Thanks for this. However, since this is an external module and not related to Nuxt UI, documentation will be left as is 😄 .

@maximepvrt
Copy link
Contributor Author

@moshetanzer It's still a shame not to be able to use @nuxt/Image for the avatar component, for example. Google PageSpeed advises me to use it, but I can't. It could be an option to enable.

Capture d’écran 2024-03-28 à 01 56 25

@moshetanzer
Copy link
Collaborator

Aha. Interesting we do use img in avatar @benjamincanac thoughts?

Copy link
Member

Oh didn't think about the Avatar component indeed, this should be possible yes.

@benjamincanac benjamincanac reopened this Mar 28, 2024
@benjamincanac benjamincanac changed the title add NuxtImg support for Nuxt Ui components [Avatar] Support NuxtImg Mar 28, 2024
Copy link
Member

I've added an as prop to the UAvatar component so now you can just do:

<script setup>
const NuxtImg = resolveComponent('NuxtImg')
</script>

<template>
  <UAvatar :as="NuxtImg" src="https://github.com/avatars/u/739984?v=4" />
</template>

@cybandy
Copy link

cybandy commented Jul 2, 2024

This is so helpful. Can you include it in the documentation @benjamincanac ?

@maximepvrt
Copy link
Contributor Author

We could activate it automatically with this #1289 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
4 participants