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?
http://quasar-framework.org/guide/quasar-upgrade-guide.html
More specifically: http://quasar-framework.org/guide/quasar-upgrade-guide.html#Some-components-need-native-modifier-for-events-now
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 ...
Most helpful comment
http://quasar-framework.org/guide/quasar-upgrade-guide.html
More specifically: http://quasar-framework.org/guide/quasar-upgrade-guide.html#Some-components-need-native-modifier-for-events-now