image error handling

UI Components for Vue
Post Reply
nadav
Posts: 1
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

Post Reply

Return to “PrimeVue”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest