Quasar: QItem does not trigger click event anymore.

Created on 3 Mar 2018  路  6Comments  路  Source: quasarframework/quasar

I'm migrating the code from the v0.14 to v0.15 and on my old menu component i had something like this

<q-item v-for="mItem in menuElements"
    :key="mItem.id"
    @click="selectElement(mItem.route)">
        <q-item-side :icon="mItem.icon" />
        <q-item-main :label="mItem.label" :sublabel="mItem.sublabel" />
</q-item>

An example of a menu element would be: (not relevant because this works, but for testing purpouse)

{
    id: 0,
    label: this.$t('Home'),
    sublabel: this.$t('Go to home page'),
    route: '/dashboard',
    icon: 'home'
}

This code used to work well. Im debugging using a console.log in the selectElement method (is in the same component) and q-item is not triggering click event.
Any idea why is this happening? If there is some rewrite in the component and is not possible to do it this way anymore, is there an elegant way to solve this when the user click the full component instead just the label?

Most helpful comment

All 6 comments

The links above are broken now. Maybe some code would be more useful instead.

@leosdad What version of Quasar are you using?

Anyway, for v1 head this way: https://quasar.dev/start/upgrade-guide#Introduction

Version 1.4.1 here. I was looking for some sample code to process click events from QMenu items, since the QMenu page does not provide any examples, and I stubled upon this topic. I know it refers to something that is not directly related to my problem. In any case, thanks a lot for the quick response!

Ah, ok. In v1 you can attach @click listeners directly on the <q-item> in the menu.

And <q-item clickable ...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jigarzon picture jigarzon  路  3Comments

mesqueeb picture mesqueeb  路  3Comments

slowaways picture slowaways  路  3Comments

Bangood picture Bangood  路  3Comments

wc-matteo picture wc-matteo  路  3Comments