No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    QCarousel slide - use img onerror event attribute

    Help
    2
    2
    261
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P
      PSTA last edited by

      Hi,
      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.

      1 Reply Last reply Reply Quote 0
      • C
        chyde90 last edited by

        I’m assuming you are using the img-src prop on the q-carousel-slide component 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.

        Note the q-pa-none class on the q-carousel-slide and the q-carousel should probably not have the padding prop

        1 Reply Last reply Reply Quote 0
        • First post
          Last post