You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I'm using Vue Router and all works fine in my app. But I've got a question. If I try to read $router.query from a component, event on mounted() or created(), I get an empty object, event if I load the page from an url like this: http://localhost:3000/agritour/aziende-agricole/#/?features=biologico. Why?
It seems the only way I have to get the query is through a watcher:
this.$watch(()=>this.$route,function(this_route,prev_route){console.log('query',this.$route.query);// now it works},{flush: 'post'});
But I guess this should not be the first choice.
Any idea? By the way, as you can see I'm currently using vue's option api, not composition.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi, I'm using Vue Router and all works fine in my app. But I've got a question. If I try to read $router.query from a component, event on mounted() or created(), I get an empty object, event if I load the page from an url like this:
http://localhost:3000/agritour/aziende-agricole/#/?features=biologico
. Why?It seems the only way I have to get the query is through a watcher:
But I guess this should not be the first choice.
Any idea? By the way, as you can see I'm currently using vue's option api, not composition.
Beta Was this translation helpful? Give feedback.
All reactions