nuxt-modules / ionic

Batteries-included, zero-config Ionic integration for Nuxt
https://ionic.nuxtjs.org
MIT License
356 stars 38 forks source link

Tab not marked as selected on initial route #575

Open DepkaCZ opened 1 month ago

DepkaCZ commented 1 month ago

📚 What are you trying to do?

Hi,

according to docs you should set alias to / on the tab you wish to render instead of having index.vue in pages 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

buddy94 commented 4 weeks ago

I have the same problem! As a workaround I created an index page outside my tabs and in the onBeforeMounted i redirect the user to the tabs/home: router.replace('/tabs/home');

This was working fine until the new update. Now it will not be redirect to the /tabs/home and I don't know why...

CHIBX commented 3 weeks ago

@DepkaCZ Can you drop a link to your current reproduction

DepkaCZ commented 3 weeks ago

@CHIBX Hi, just run the playground and navigate to / route