QCarousel slide - use img onerror event attribute
is there any way, how use img tag event attribute onerror with Carousel slide component?
I have Carousel with images. All images are saved in the cloud. I want to show on the slide default static image, if will be not possible load original image from the server.
I’m assuming you are using the
img-srcprop on the
q-carousel-slidecomponent like this:
<q-carousel-slide :name="1" img-src="https://cdn.quasar.dev/img/mountains.jpg" />
You could do this instead to archieve something similar:
<q-carousel-slide name="1" class="q-pa-none"> <img src="https://cdn.quasar.dev/img/mountains.jpg" alt="mountains" class="fit" style="object-fit: cover;"> </q-carousel-slide>
So that you can add your onerror-listener to the<img> tag yourself.
q-pa-noneclass on the
q-carouselshould probably not have the