From 81de29c8ca9ad2a99a27d0d693bd26d15f45b69c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tu=C4=9F=C3=A7e=20K=C3=BC=C3=A7=C3=BCko=C4=9Flu?= Date: Wed, 2 Aug 2023 12:18:47 +0300 Subject: [PATCH] Fixed #4222 - Avatar: Return target in error event callback --- api-generator/components/avatar.js | 9 ++++++++- components/lib/avatar/Avatar.d.ts | 2 +- components/lib/avatar/Avatar.vue | 4 ++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/api-generator/components/avatar.js b/api-generator/components/avatar.js index b87088bc4..396e4b681 100644 --- a/api-generator/components/avatar.js +++ b/api-generator/components/avatar.js @@ -53,7 +53,14 @@ const AvatarSlots = [ const AvatarEvents = [ { name: 'error', - description: 'Triggered when an error occurs while loading an image file.' + description: 'Triggered when an error occurs while loading an image file.', + arguments: [ + { + name: 'event', + type: 'object', + description: 'Browser event' + } + ] } ]; diff --git a/components/lib/avatar/Avatar.d.ts b/components/lib/avatar/Avatar.d.ts index 19cb88874..0ad6ad6f2 100644 --- a/components/lib/avatar/Avatar.d.ts +++ b/components/lib/avatar/Avatar.d.ts @@ -125,7 +125,7 @@ export interface AvatarEmits { /** * Triggered when an error occurs while loading an image file. */ - error(): void; + error(event: Event): void; } /** diff --git a/components/lib/avatar/Avatar.vue b/components/lib/avatar/Avatar.vue index 3b3a736d9..892e6fa58 100644 --- a/components/lib/avatar/Avatar.vue +++ b/components/lib/avatar/Avatar.vue @@ -17,8 +17,8 @@ export default { extends: BaseAvatar, emits: ['error'], methods: { - onError() { - this.$emit('error'); + onError(event) { + this.$emit('error', event); }, getPTOptions(key) { return this.ptm(key, {