alanhe421 / CodeTracker

:tada:a Wakatime client
http://1991421.cn/about
6 stars 0 forks source link

nav-menu点击,进入某页面,不显示back按钮 #7

Closed alanhe421 closed 7 years ago

alanhe421 commented 7 years ago

如题,左侧一级导航菜单按钮点击,不要显示back返回按钮,但是显示菜单按钮

alanhe421 commented 7 years ago

左侧菜单点击实现code如下

HomePage.ts

 @ViewChild(Nav) nav: Nav;

  // Reset the content nav to have just this page
    // we wouldn't want the back button to show in this scenario
    openPage(page: any) {
        // this.navCtrl.push(page);
        this.nav.setRoot(page);
    }

home.html

<ion-menu [content]="content">
 <ion-content>
<ion-list>
            <button menuClose ion-item icon-left *ngFor="let page of pages" (click)="openPage(page.component)">
                <ion-icon name="{{page.icon}}"></ion-icon>
                {{page.title}}
            </button>
        </ion-list>
  </ion-content>
</ion-menu>
<ion-nav #content [root]="rootPage" swipeBackEnabled="false"></ion-nav>

单个page页面

<ion-header>
    <ion-navbar>
        <button ion-button menuToggle>
            <ion-icon name="menu"></ion-icon>
        </button>
        <ion-title>Projects</ion-title>
    </ion-navbar>

</ion-header>

<ion-content padding>
    <ion-card *ngFor="let item of items" (click)="showCommits(item['id'])">
        <ion-card-header>
            {{item?.name}}
        </ion-card-header>

        <ion-card-content>
            {{item?.public_url}}
        </ion-card-content>

    </ion-card>
</ion-content>