mirror of
https://github.com/Spythere/pojazdownik.git
synced 2026-05-03 19:48:11 +00:00
chore: added functionality for not found vehicle images
This commit is contained in:
@@ -60,7 +60,12 @@
|
||||
@keydown.enter="onVehicleSelect(vehicle)"
|
||||
tabindex="0"
|
||||
>
|
||||
<img loading="lazy" width="120" :src="getThumbnailURL(vehicle.type, 'small')" />
|
||||
<img
|
||||
loading="lazy"
|
||||
width="120"
|
||||
:src="getThumbnailURL(vehicle.type, 'small')"
|
||||
@error="onThumbnailImageError"
|
||||
/>
|
||||
|
||||
<span>
|
||||
<span
|
||||
@@ -163,6 +168,13 @@ export default defineComponent({
|
||||
methods: {
|
||||
isTractionUnit,
|
||||
|
||||
onThumbnailImageError(e: Event) {
|
||||
const el = e.target as HTMLImageElement;
|
||||
|
||||
if (el.src == '/images/no-vehicle-image.png') return;
|
||||
el.src = '/images/no-vehicle-image.png';
|
||||
},
|
||||
|
||||
onVehicleSelect(vehicle: IVehicle) {
|
||||
if (this.store.chosenVehicle?.type === vehicle.type) this.addVehicle(vehicle);
|
||||
this.previewVehicle(vehicle);
|
||||
|
||||
Reference in New Issue
Block a user