chore: added functionality for not found vehicle images

This commit is contained in:
2024-12-23 16:20:38 +01:00
parent 61972c35e6
commit 91803d3fef
4 changed files with 39 additions and 8 deletions
@@ -5,7 +5,7 @@
@keydown.esc="store.vehiclePreviewSrc = ''"
tabindex="0"
>
<img :src="store.vehiclePreviewSrc" alt="preview" />
<img :src="store.vehiclePreviewSrc" alt="preview" @error="onImageError" />
</div>
</template>
@@ -23,6 +23,14 @@ export default defineComponent({
mounted() {
this.$el.focus();
},
methods: {
onImageError(event: Event) {
if(!event.target || !(event.target instanceof HTMLImageElement)) return
event.target.src = '/images/no-vehicle-image.png';
},
},
});
</script>