Vue js - Set alt image when image source not found
You can set an onerror
handler function with @error
in Vue:
<img :src="" @error="aVueFunctionThatChangesTheSrc">
Since in pure js put onerror inline like this
<img :src="ImgUrl" onerror="this.src='http://example.com/default.jpg'"/>
for vue.js we can replace it
<img :src="ImgUrl" @error="$event.target.src='http://example.com/default.jpg'"/>