image error handling

UI Components for Vue
Post Reply
nadav
Posts: 3
Joined: 22 Sep 2022, 10:51

22 Sep 2022, 10:58

hello,
i'm using @error on image components and when i updated to 3.17 the $event param stopped being passed into function.
any reason as to why?

i have this in some component:
<Image :src="showImg(slotProps.data.Image)" @error="onImageError" defimg="profiles/noface.jpg" alt="noface" class="border-round-sm" :imageStyle="{'border-radius':'5px','max-width':'70px','max-height':'70px','min-width':'60px','min-height':'60px'}" preview>

and the function in a js file:
onImageError(e) {
let defaultImage =
typeof $(e.target).attr("defimg") == "undefined"
? "question-icon.jpg"
: $(e.target).attr("defimg");
$(e.target).attr("src", this.$conf.IMG + defaultImage);
}

started getting this after update:
Uncaught TypeError: Cannot read properties of undefined (reading 'target')

thanks

bahadirsofuoglu
Posts: 84
Joined: 06 Sep 2022, 08:59

18 Oct 2022, 12:47

Hi,
Could you share any link for reproducing?

Post Reply

Return to “PrimeVue”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 15 guests