const routes: Routes = [
{
path: '',
component: TabsPage,
children: [
//new page add
{
path: 'home',
children: [
{
path: '', loadChildren: () => import('../AllPages/home/home.module').then(m => m.HomePageModule)
},
{
path: 'new-arrival',
children: [
{
path: '',
loadChildren: () => import('../AllPages/new-arrival/new-arrival.module').then(m => m.NewArrivalPageModule)
},
{
path: 'product-item-list',
children: [
{
path: '',
loadChildren: () => import('../Allpages/product-item-list/product-item-list.module').then(m => m.ProductItemListPageModule)
},
{
path: 'product-details',
children: [
{
path: '',
loadChildren: () => import('../Allpages/product-details/product-details.module').then(m => m.ProductDetailsPageModule)
},
]
}
]
}
]
},
使用Ionic NavController而不是Angular Router
然后,使用navigateRoot
方法。
转到root意味着堆栈中所有现有页面都将被删除,导航的页面将成为堆栈中的单个页面。
import { NavController } from '@ionic/angular';
...
constructor(private navController: NavController) {}
...
this.navController.navigateRoot('/tabs/home');