简体   繁体   English

按钮单击关闭离子3侧菜单

[英]Ionic 3 side menu close on button click

I am showing some categories in side menu which is working fine . 我在侧面菜单中显示一些工作正常的类别。 but i need when i click on category then the category show . 但我需要当我点击类别然后类别显示。 and it also work fine . 它也工作正常。 but the problem is when i click on category it shows the category but closes the menu . 但问题是当我点击类别它显示类别但关闭菜单。 (so if i need to see the category im opening the sidemenu again . i dont want to close the side menu ) . (所以,如果我需要看到类别我再次打开侧面菜单。我不想关闭侧面菜单)。

  <div class="list-item-divider" (click)="onButtonClick()">
     <ion-item-divider tappable menuClose (click)="shop()">
      <ion-icon item-left ios="ios-home" md="md-home">
      </ion-icon>
      <strong>{{"Categories" | translate}}
      </strong>
    </ion-item-divider>
  </div>        

 <div *ngIf="buttonClicked" >
  <div *ngIf="service.categories" class="category-name">
    <ion-item tappable full menuClose *ngFor="let item of 
       service.mainCategories" (click)="getCategory(item.id, item.slug, 
        item.name)">
      <ion-icon item-right class="ion-ios-arrow-forward item-icon">
      </ion-icon>
      <span [innerHTML]="item.name"></span>     
    </ion-item>
  </div>
</div>

.ts .TS

   public buttonClicked: boolean = false;

     public onButtonClick() {
      this.buttonClicked = !this.buttonClicked;
    }

if i understand correctly, you do not need to close sidemenu when you tap on any of the links within 如果我理解正确,当你点击其中的任何链接时,你不需要关闭sidemenu

then you need to remove the menuClose there. 然后你需要删除menuClose那里。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM