我使用
克隆了代码离子启动myprojectName教程
并根据离子3更改了项目,现在,有一个文件列表。我想在那儿有一个后退按钮,然后删除了侧菜单开放的代码。预计该返回按钮会自动出现,但没有发生,而是显示标题没有任何标题。
的标题。在此项目中,您会找到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>
它只有一个标题,没有后背导航按钮,这可能需要我root Page
您可以在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中的标头代码。
<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>
让我知道它是否适合您?