-
-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Empty route.params
object on navigation
#121
Comments
This is still broken on |
I had this issue, how I fixed it was by importing it from vue router.
and using this one rather than the auto imported one Tested on |
I ran into the same. The workaround provided by @MikeyBeLike seems to work. I tried looking if there is a way to globally (in the Maybe there is one⦠please let me/us know if you know a way. Thanks |
The solution given by @MikeyBeLike worked! In my case, I have something like this in the composable (so it is global). I only had to add the import in the composable, and everything worked again as expected. import { useRoute } from 'vue-router'
// ...
export const useNavigation = () => {
const router = useIonRouter();
const route = useRoute();
return {
route,
push: (name: RouteName, options?: RouteOptions) => {
router.push({ name, params: options?.params });
},
replace: (name: RouteName) => router.replace({ name }),
};
}; So in my components, I can do: const navigation = useNavigation()
// and then
navigation.route // same as const route = useRoute()
navigation.push('home') // route name is hinted by RouteName type.
navigation.replace('home') // same as `push` Regardless, it is still an issue that needs to be addressed. |
That's "a way" but does not solve the issue of having to use something non standard. |
π The bug
When navigating to a new page, the
route.params
object fromuseRoute
is empty.π οΈ To reproduce
https://stackblitz.com/edit/github-hz29vt?file=pages/tabs/tab1.vue
π Expected behaviour
It should be an object with the current route parameters, query, etc.
βΉοΈ Additional context
0.6.1
.route.params
object show the correct content.The text was updated successfully, but these errors were encountered: