-
-
Notifications
You must be signed in to change notification settings - Fork 38
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
Tab not marked as selected on initial route #575
Comments
I have the same problem! This was working fine until the new update. Now it will not be redirect to the /tabs/home and I don't know why... |
@DepkaCZ Can you drop a link to your current reproduction |
@chibx Hi, just run the playground and navigate to |
I was having the same issue Ionic's documentation suggests redirecting from Example from Usage with Router - ionicframework.com: // src/router.ts
const routes: Array<RouteRecordRaw> = [
{ path: '/', redirect: '/home', },
{
path: '/',
component: Tabs,
children: [
{ path: '', redirect: '/home', },
{ path: 'home', component: () => import('./views/HomePage.vue'), },
}
] What helped me is creating <!-- pages/index.vue -->
<script lang="ts" setup>
definePageMeta({
redirect: "/tabs/home",
});
</script> <!-- pages/tabs/home/index.vue -->
<script lang="ts" setup>
definePageMeta({
alias: ["/tabs"],
});
</script> This way navigating to |
📚 What are you trying to do?
Hi,
according to docs you should set alias to
/
on the tab you wish to render instead of havingindex.vue
inpages
directory. That works fine as the tab gets rendered but the button in<ion-tab-bar>
is not marked as selected. This doesn't work even in the modules playground project.Does anyone know please how to fix that other than checking for route programatically and setting selected to true ?
🔍 What have you tried?
I've tried to change the
href
on<ion-tab-button>
to/
but that completely ruined the active tab detection. Furthermore, can some please explain to me how does it even work please ? Like ...when i set alias in define page meta on specific tab how does it know to render the parent component as well ? It's pretty unclear from the docs :(ℹ️ Additional context
No response
The text was updated successfully, but these errors were encountered: