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

chore: upgrade components to composition API #571

Merged
merged 6 commits into from
Sep 3, 2022
Merged

chore: upgrade components to composition API #571

merged 6 commits into from
Sep 3, 2022

Conversation

Diizzayy
Copy link
Member

This PR upgrades the NuxtImg and NuxtPicture components to use the Composition API, and exposes a new useImage composable with the same behavior of the $img utility.

Other changes:

  • the nuxt-img component now supports preload

@netlify
Copy link

netlify bot commented Jul 15, 2022

Deploy Preview for nuxt-image-v1 canceled.

Name Link
🔨 Latest commit db7f982
🔍 Latest deploy log https://app.netlify.com/sites/nuxt-image-v1/deploys/63138640780710000a18ac48

@AndersNielsen85
Copy link

Would be nice adding the example directly to docs. Don't know if that should go to a separate PR? :)

<script lang="ts" setup>
const { generate } = useImage()
const bg = computed(() => {
  const imgUrl = generate('/images/colors.jpg', {
    width: 300,
    height: 300,
    quality: 80
  })
  return `url('${imgUrl}')`
})
</script>```

Copy link
Member

@pi0 pi0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for helping on this. Nice changes ❤️

@pi0
Copy link
Member

pi0 commented Sep 3, 2022

@AndersNielsen85 I changed back usage to $img = useImage() ($img is a function with attached props)

@pi0 pi0 merged commit a379087 into nuxt:v1 Sep 3, 2022
pi0 added a commit that referenced this pull request Sep 3, 2022
Co-authored-by: Pooya Parsa <pooya@pi0.io>
@Diizzayy
Copy link
Member Author

Diizzayy commented Sep 3, 2022

Thanks for helping on this. Nice changes ❤️

@pi0 no problem, happy to help.

procrates pushed a commit to procrates/nuxt-image that referenced this pull request Feb 21, 2023
Co-authored-by: Pooya Parsa <pooya@pi0.io>
@pi0 pi0 mentioned this pull request Mar 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants