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

    Difference in QItemSide in v0.15 - @error processing

    Framework
    4
    6
    1059
    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.
    • qyloxe
      qyloxe last edited by

      in v0.14 it worked:

          <q-item v-for="(item, index) in products" :key="item.id">
            <q-item-side :image="'http://example.com/'+item.url+'.jpg'" v-if="item.url" @error="item.url=''" />
            <q-item-side image="http://example.com/220x220.png" v-else />
      

      in 0.15, the @error event is not processed at q-item-side context and we need to write such a bloated code for situations, when there is no image at specified url (404):

          <q-item v-for="(item, index) in products" :key="item.id">
              <q-item-side>
                <q-item-tile image>
                  <img class="q-item-image" :src="'http://example.com/'+item.url+'.jpg'" v-if="item.url" @error="item.url=''" />
                  <img class="q-item-image" src="http://example.com/220x220.png" v-else />
                </q-item-tile>
              </q-item-side>
      

      I assume @error event is not correctly processed in many other components, too.

      1 Reply Last reply Reply Quote 0
      • benoitranque
        benoitranque last edited by

        Just an idea: have you tried @error.native ?

        1 Reply Last reply Reply Quote 0
        • qyloxe
          qyloxe last edited by

          tried now - all versions:

          q-itemside @error -> not working
          q-itemside @error.native -> not working
          img @error -> working
          img @error.native -> not working

          1 Reply Last reply Reply Quote 0
          • qyloxe
            qyloxe last edited by qyloxe

            Another solution is to use such an amazingly simple component for list images, which URL’s could lead to 404. At the end of the day, frankly, I do even prefer this solution with custom image component:

              <template>
                <img class="q-item-image" :src="imgsrc"  @error="setError()" v-if="imgsrc">
              </template>
            
              <script type="text/javascript">
              export default {
                name: 'SafeImage',
                props: [
                  'src',
                  'altsrc'
                ],
                data () {
                  return {
                    imgsrc: ''
                  }
                },
                created () {
                  this.imgsrc = this.src
                },
                methods: {
                  setError () {
                    this.imgsrc = this.altsrc
                  }
                }
              }
              </script>
              <style scoped>
              </style>
            1 Reply Last reply Reply Quote 0
            • rstoenescu
              rstoenescu Admin last edited by

              Explanation here: http://quasar-framework.org/guide/quasar-upgrade-guide.html#Some-components-need-native-modifier-for-events-now
              Dismiss the “native” modifier. What I want to emphasize here is how some components changed from functional components to regular components, including QItem & co.

              marcelo 1 Reply Last reply Reply Quote 0
              • marcelo
                marcelo @rstoenescu last edited by

                @rstoenescu In the upgrade Docs you just mention to use
                QItem with @click=$route.push("…")

                Should change to @click.native=$route.push("…") to avoid confusion…

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