Ionic framework 返回导航按钮未显示

Ionic framework 返回导航按钮未显示,ionic-framework,ionic2,ionic3,Ionic Framework,Ionic2,Ionic3,我使用 离子启动myProjectName教程 并根据ionic 3更改了项目,现在,有一个文件list.html,它在标题处有一个按钮,可以打开侧菜单。我想在那里有一个后退按钮,并删除了侧菜单打开的代码。预计“后退”按钮将自动显示,但它并没有出现,相反,它显示的标题中并没有任何只写标题的按钮 在本项目中,您将找到list.html,我对其进行了如下修改: <ion-header> <ion-navbar> <ion-title>My Firs

我使用

离子启动myProjectName教程

并根据ionic 3更改了项目,现在,有一个文件list.html,它在标题处有一个按钮,可以打开侧菜单。我想在那里有一个后退按钮,并删除了侧菜单打开的代码。预计“后退”按钮将自动显示,但它并没有出现,相反,它显示的标题中并没有任何只写标题的按钮

在本项目中,您将找到list.html,我对其进行了如下修改:

  <ion-header>
  <ion-navbar>
    <ion-title>My First List</ion-title>
  </ion-navbar>
</ion-header>
<ion-content>
  <ion-list>
    <button ion-item *ngFor="let item of items" (click)="itemTapped($event, item)">
      <ion-icon name="{{item.icon}}" item-left></ion-icon>
      {{item.title}}
      <div class="item-note" item-right>
        {{item.note}}
      </div>
    </button>
  </ion-list>
</ion-content>

我的第一份名单
{{item.title}
{{item.note}

它只有一个标题,没有向后导航按钮,可以把我带到根页面

这里有一些在爱奥尼亚的标题代码

<ion-view>
<ion-nav-bar>
    <ion-nav-buttons side="left">
        <button class="button button-clear  ion-arrow-left-c  " ng-click="backButton()"></button>
    </ion-nav-buttons>
    <ion-nav-buttons side="right">
        <button class="button button-clear btn-white ion-android-settings header-icon-size " ng-click="openDrawer()"></button>
    </ion-nav-buttons>
</ion-nav-bar>
<ion-content>
    <!-- here content -->
</ion-content>
</ion-view>


让我知道它是否适合你

您可以在app.component.ts中添加以下代码

itemTapped(item) {
    // close the menu when clicking a link from the menu
    this.menu.close();
    // navigate to the new page if it is not the current page
    this.nav.push(page.component);
 }

您提供的代码是正确的,但它是不可行的,因为手动调用后退按钮上的函数将使我返回到它顶部的上一页,IONIC 2提供了默认的后退按钮,可以轻松地工作