From fc3013145fe93ea9834fd85d42f37296bf74c41d Mon Sep 17 00:00:00 2001 From: Johann Schopplich Date: Thu, 4 Apr 2024 22:22:22 +0200 Subject: [PATCH] fix(nuxt): emit `loaded` event for preloaded images --- packages/nuxt/src/runtime/components/UnLazyImage.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/nuxt/src/runtime/components/UnLazyImage.vue b/packages/nuxt/src/runtime/components/UnLazyImage.vue index b2d2d7f..1cd5c9b 100644 --- a/packages/nuxt/src/runtime/components/UnLazyImage.vue +++ b/packages/nuxt/src/runtime/components/UnLazyImage.vue @@ -111,6 +111,7 @@ watchEffect(() => { if (props.autoSizes) _autoSizes(target.value) loadImage(target.value) + emit('loaded', target.value) return } @@ -120,7 +121,9 @@ watchEffect(() => { // Placeholder is already decoded cleanup = lazyLoad(target.value, { hash: false, - onImageLoad: image => emit('loaded', image), + onImageLoad(image) { + emit('loaded', image) + }, }) })