我第一次开始使用Ionic。目前我有一个listview
,当进入列表时会出现后退按钮。
<ion-nav-bar class="bar-stable nav-title-slide-ios7">
<ion-nav-back-button class="button-icon icon ion-ios7-arrow-back">
Back
</ion-nav-back-button>
</ion-nav-bar>
现在如何在屏幕右侧添加一个按钮,也只在移动到列表后出现?
答案 0 :(得分:26)
这就是我最终做的事情:
<ion-nav-bar class="bar-stable nav-title-slide-ios7">
<ion-nav-back-button class="button-icon icon ion-ios7-arrow-back">
Back
</ion-nav-back-button>
<ion-nav-buttons side="right">
<button class="button button-clear button-positive" ng-click="reset()">
Refresh
</button>
</ion-nav-buttons>
</ion-nav-bar>
答案 1 :(得分:10)
您可以使用<ion-header-bar align-title="right">
完全实施(左右)(来自docs):
<ion-header-bar align-title="left" class="bar-positive">
<div class="buttons">
<button class="button" ng-click="doSomething()">Left Button</button>
</div>
<h1 class="title">Title!</h1>
<div class="buttons">
<button class="button">Right Button</button>
</div>
</ion-header-bar>
<ion-content>
Some content!
</ion-content>
击> <击> 撞击>
正如Harry指出的那样,添加ion-nav-buttons
并设置side=right
是实现此目标的正确方法。
(复制自@ harry&#39;
)<ion-nav-bar class="bar-stable nav-title-slide-ios7">
<ion-nav-back-button class="button-icon icon ion-ios7-arrow-back">
Back
</ion-nav-back-button>
<ion-nav-buttons side="right">
<button class="button button-clear button-positive" ng-click="reset()">
Refresh
</button>
</ion-nav-buttons>
</ion-nav-bar>
答案 2 :(得分:4)
答案 3 :(得分:0)
<ion-header>
<ion-toolbar color="primary">
<ion-title class="titleHeader">User Detail</ion-title>
<ion-buttons slot="end">
<ion-back-button defaultHref="/"></ion-back-button>
</ion-buttons>
</ion-toolbar>
</ion-header>
您还可以在这里找到答案:Ionic 2 / 3 / 4 : How to align button in the header to the right side of header