Within my Vuetify application, I am utilizing a v-img
component and I am looking to implement a fallback image in case the primary one fails to load.
<v-img :src="cPicture" contain v-on:error="onImgError"></v-img>
cPicture : function() {
return this.failed_image ? "https://assets.dryicons.com/uploads/icon/svg/9872/ab3c0a16-6f14-4817-a30b-443273de911d.svg" : "http://myimg.jpg/";
},
onImgError : function(event) {
alert(1);
this.failed_image = true;
//this.$forceUpdate();
},
The alert message appears as expected. However, an error is also thrown by Vuetify in the console, and the fallback image is not displayed.
How can I resolve this issue?
Note that the main image link intentionally leads to a non-existent location, but if a valid link is provided, it will be successfully rendered.