Ionic 我无法在图标菜单的帮助下显示页面,也无法单击项目

yx2lnoni  于 2022-12-08  发布在  Ionic
关注(0)|答案(1)|浏览(137)

ion-menu is not working

This is my sidemenu.component.html

<ion-split-pane contentId="menu-content" when="xs">
       <ion-menu contentId="menu-content" >
        <ion-content>
         <ion-item  *ngIf="tabSelec == 'lead'" lines="none" routerLink="/hometab/lead    
         routerDirection="root" routerLinkActive="active-link">
          <ion-icon  src="assets/imgs/leadsSelec.svg"></ion-icon>
            <ion-label> Leads </ion-label>
        </ion-item>

        <ion-item *ngIf="tabSelec != 'lead'" lines="none" routerLink="/hometab/lead   
          routerDirection="root" routerLinkActive="active-link">
           <ion-icon  src="assets/imgs/sitesSelec.svg"></ion-icon>
            <ion-label>Leads</ion-label>
         </ion-item>

        <ion-item  *ngIf="tabSelec == 'sites'" lines="none" routerLink="/hometab/sites   
        [queryParams]="{pri: 'leads', sec: true}"  routerDirection="root" 
        routerLinkActive="active-link">
          <ion-icon class="img" src="assets/imgs/sitesSelec.svg"></ion-icon>
            <ion-label > Sites  </ion-label>
        </ion-item>

        <ion-item *ngIf="tabSelec != 'sites'" lines="none" routerLink="/hometab/sites
         [queryParams]="{pri: 'leads', sec: true}"  routerDirection="root" 
        routerLinkActive="active-link">
          <ion-icon  class="img" src="assets/imgs/sitesSelec.svg"></ion-icon>
            <ion-label> Sites </ion-label>
        </ion-item>
       </ion-content>  
      </ion-menu>
      <ion-router-outlet id="menu-content"></ion-router-outlet>

      </ion-split-pane>

This is my hometab-rotuing.module.ts

{
    path:'',
    redirectTo: '/hometab/lead.module',
    pathMatch: 'full'

  },

  {
    path:'',
    component: HometabPage,
    children :[
      {
        path: 'lead',
        loadChildren: () => import('../lead/lead.module').then(m => m.LeadPageModule)
      },
      {
        path: 'sites',
        loadChildren: () => import('../sites/sites.module').then(m => m.SitesPageModule) 
      },    
      {
        path: 'testing',
        loadChildren: () => import('../testing/testing.module').then(m => m.TestingPageModule)
      },
     
    ]
  },

Any idea how does it suppose to work? It should automatically redirect me to the lead page after login
Also I'm not able to click on my ion-item, any help appreciated

rjzwgtxy

rjzwgtxy1#

您必须提供带有contentId属性的标记,它表示使用sidemu导航时要显示的容器的id。
示例:

<ion-menu contentId="your-main-content-id" side="start">...</ion-menu>
      ...
   //you can use any order valid html container tag
   <ion-content id="your-main-content-id">...</ion-content>

相关问题