Skip to content

Commit

Permalink
feat(nuxt): emit error event (closes #42)
Browse files Browse the repository at this point in the history
  • Loading branch information
johannschopplich committed Feb 19, 2024
1 parent ec605f9 commit a79fc71
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/nuxt/src/runtime/components/UnLazyImage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ const props = withDefaults(
const emit = defineEmits<{
(event: 'loaded', image: HTMLImageElement): void
(event: 'error', error: Event): void
}>()
const unlazy = useRuntimeConfig().public.unlazy as ModuleOptions
Expand Down Expand Up @@ -145,6 +146,7 @@ onBeforeUnmount(() => {
:data-srcset="srcSet"
:data-sizes="autoSizes ? 'auto' : undefined"
loading="lazy"
@error="emit('error', $event)"
>
</picture>
<img
Expand All @@ -156,5 +158,6 @@ onBeforeUnmount(() => {
:data-srcset="srcSet"
:data-sizes="autoSizes ? 'auto' : undefined"
loading="lazy"
@error="emit('error', $event)"
>
</template>

0 comments on commit a79fc71

Please sign in to comment.