[SOLVED] [v1] q-expansion-item: is it possible to have BOTH a route AND menu-click expansion?
-
I would like to have my expansion item expand when clicking anywhere in it, AND go to the route defined, but it seems if I have a route defined, ONLY the icon click will trigger the expansion. Is there anyway to make both things happen on clicking anywhere on the item (as it does when there is no route defined)?
-
ok I found a solution for this (although a toggle would be nice so I don’t have to resort to this):
@show="openRoute('/myroute')" @hide="openRoute('/myroute')"
with a method defined in my file that takes care of this:
openRoute (route) { this.$router.push(route) }
The bad part about this is that now the expansion item no longer realizes when it is active, so I will have to add some logic to take care of the active class as well. This whole thing would be made much easier if q-expansion item just allowed both routes and open actions at the same time natively.
-
@ssuess - Did you try it the other way around? Use the
to
prop and use the@click
event to open and close the item?Scott
-
I will try that @s-molinari thanks for the suggestion
-
@s-molinari thanks! Your simple suggestion has actually allowed me to solve this problem AND the tree expansion problem here: https://forum.quasar-framework.org/topic/3403/v1-q-expansion-item-open-tree-when-route-is-active
-
Great! Always glad when I can help!
Scott