Skip to content

chore: upgrade components to composition API - #571

Merged
pi0 merged 6 commits into
nuxt:v1from
Diizzayy:chore/improve-components
Sep 3, 2022
Merged

chore: upgrade components to composition API#571
pi0 merged 6 commits into
nuxt:v1from
Diizzayy:chore/improve-components

Conversation

@Diizzayy

Copy link
Copy Markdown
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

netlify Bot commented Jul 15, 2022

Copy link
Copy Markdown

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
Copy Markdown

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>```

@pi0 pi0 left a comment

Copy link
Copy Markdown
Member

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

pi0 commented Sep 3, 2022

Copy link
Copy Markdown
Member

@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

Diizzayy commented Sep 3, 2022

Copy link
Copy Markdown
Member Author

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
@github-actions github-actions Bot mentioned this pull request Jul 30, 2026
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