Good morning. I’m developing an app using Ionic + vanilla JavaScript + Stencil.
My app has tab-based navigation.
app-root.tsx
<ion-router useHash={false}>
<ion-route-redirect from="/" to="/home" />
<ion-route component="page-tabs">
<ion-route url="/home" component="tab-home">
<ion-route component="page-home"></ion-route>
</ion-route>
<ion-route url="/map" component="tab-map">
<ion-route component="page-map"></ion-route>
</ion-route>
<ion-route url="/refueling" component="tab-refueling">
<ion-route component="page-refueling"></ion-route>
</ion-route>
<ion-route url="/awards" component="tab-awards">
<ion-route component="page-awards"></ion-route>
</ion-route>
<ion-route url="/other" component="tab-other">
<ion-route component="page-other"></ion-route>
<ion-route url="/account" component="page-account"></ion-route>
<ion-route url="/other/account" component="page-account"></ion-route>
</ion-route>
</ion-route>
<ion-route url="/welcome" component="page-welcome"></ion-route>
<ion-route url="/login" component="page-login"></ion-route>
<ion-route url="/signin" component="page-signin"></ion-route>
<ion-route url="/forgotpwd" component="page-forgot-pwd"></ion-route>
</ion-router>
page-tabs
<ion-tabs>
<ion-tab tab="tab-home" component="page-home">
</ion-tab>
<ion-tab tab="tab-map" component="page-map">
</ion-tab>
<ion-tab tab="tab-refueling" component="page-refueling">
</ion-tab>
<ion-tab tab="tab-awards" component="page-awards">
</ion-tab>
<ion-tab tab="tab-other">
<ion-nav></ion-nav>
</ion-tab>
<ion-tab-bar slot="bottom">
<ion-tab-button tab="tab-home">
<ion-icon src="/assets/icons/tab-menu/home.svg"></ion-icon>
<ion-label>Home</ion-label>
</ion-tab-button>
<ion-tab-button tab="tab-map">
<ion-icon src="/assets/icons/tab-menu/map.svg"></ion-icon>
<ion-label>Mappa</ion-label>
</ion-tab-button>
<ion-tab-button>
<ion-icon src="/assets/icons/tab-menu/refueling.svg"></ion-icon>
</ion-tab-button>
<ion-tab-button tab="tab-awards">
<ion-icon src="/assets/icons/tab-menu/award.svg"></ion-icon>
<ion-label>Premi</ion-label>
</ion-tab-button>
<ion-tab-button tab="tab-other">
<ion-icon src="/assets/icons/tab-menu/other.svg"></ion-icon>
<ion-label>Altro</ion-label>
</ion-tab-button>
</ion-tab-bar>
</ion-tabs>
I have set up my tab and router as follows.
As you can see, I have a tab called “OTHER” that has a sub-page called “ACCOUNT”.
The “ACCOUNT” page can be accessed by interacting within the “OTHER” page, which has multiple entries. However, I would like it so that when the user clicks on the “OTHER” tab, they are taken to the main “OTHER” tab instead of the last visited page within the sub-navigation.
Is it possible?