Ionic - ion-view header 按钮网显示
Ionic - ion-view header button net display
我需要在 header 部分添加按钮,但无法在 header 部分显示按钮 ion-view
:
这是我的代码:
<ion-view >
<ion-header-bar class="bar-dark">
<button class="button button-icon" >
<i class="icon ion-navicon"></i>
</button>
<h1 class="title">ToDo</h1>
<!-- New Task button-->
<button class="button button-icon" ng-click="newTask()">
<i class="icon ion-compose"></i>
</button>
</ion-header-bar>
<ion-content>
<ion-list>
<ion-item class="item-remove-animate item-avatar item-icon-right"
ng-repeat="chat in chats" type="item-text-wrap"
href="#/tab/chats/{{chat.id}}">
<img ng-src="{{chat.face}}">
<h2>{{chat.name}}</h2>
<p>{{chat.lastText}}</p>
<i class="icon ion-chevron-right icon-accessory"></i>
<ion-option-button class="button-assertive" ng-click="remove(chat)">
Delete
</ion-option-button>
</ion-item>
</ion-list>
</ion-content>
</ion-view>
而here是输出图像。
更新
我想给这张图点赞header bar
enter image description here
你可以使用这个 css 类:
<div class="bar bar-header">
<button class="button button-icon icon ion-navicon"></button>
<div class="h1 title">Header Buttons</div>
<button class="button button-clear button-positive">Edit</button>
</div>
这将在 header 两个角上的图标和它们之间的文本中显示。
这是另一个例子:
<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 class="has-header">
Some content!
</ion-content>
希望对你有帮助
编辑:
我看到你在使用标签应用,所以我找到了这个解决方案 here:
<ion-nav-buttons side="primary">
<button class="button" ng-click="doSomething()">
I'm a button on the primary of the navbar!
</button>
</ion-nav-buttons>
您可以尝试这样设置 'has-subheader' class
<ion-content class='has-header has-subheader'>
...
</ion-content>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<ion-view view-title="BBS">
<ion-header-bar class="bar bar-subheader">
<div class="button-bar">
<a class="button">web game</a>
<a class="button">mobile game</a>
</div>
</ion-header-bar>
<ion-content class="has-header">
</ion-content>
</ion-view>
尝试与 ion-nav-buttons
一起使用:
<ion-view title="ToDo">
<ion-nav-buttons side="right">
<button class="button" ng-click="newTask()">
NEW
</button>
</ion-nav-buttons>
<ion-content>
<ion-list>
<ion-item class="item-remove-animate item-avatar item-icon-right"
ng-repeat="chat in chats" type="item-text-wrap"
href="#/tab/chats/{{chat.id}}">
<img ng-src="{{chat.face}}">
<h2>{{chat.name}}</h2>
<p>{{chat.lastText}}</p>
<i class="icon ion-chevron-right icon-accessory"></i>
<ion-option-button class="button-assertive" ng-click="remove(chat)">
Delete
</ion-option-button>
</ion-item>
</ion-list>
</ion-content>
</ion-view>
我需要在 header 部分添加按钮,但无法在 header 部分显示按钮 ion-view
:
这是我的代码:
<ion-view >
<ion-header-bar class="bar-dark">
<button class="button button-icon" >
<i class="icon ion-navicon"></i>
</button>
<h1 class="title">ToDo</h1>
<!-- New Task button-->
<button class="button button-icon" ng-click="newTask()">
<i class="icon ion-compose"></i>
</button>
</ion-header-bar>
<ion-content>
<ion-list>
<ion-item class="item-remove-animate item-avatar item-icon-right"
ng-repeat="chat in chats" type="item-text-wrap"
href="#/tab/chats/{{chat.id}}">
<img ng-src="{{chat.face}}">
<h2>{{chat.name}}</h2>
<p>{{chat.lastText}}</p>
<i class="icon ion-chevron-right icon-accessory"></i>
<ion-option-button class="button-assertive" ng-click="remove(chat)">
Delete
</ion-option-button>
</ion-item>
</ion-list>
</ion-content>
</ion-view>
而here是输出图像。
更新
我想给这张图点赞header bar
enter image description here
你可以使用这个 css 类:
<div class="bar bar-header">
<button class="button button-icon icon ion-navicon"></button>
<div class="h1 title">Header Buttons</div>
<button class="button button-clear button-positive">Edit</button>
</div>
这将在 header 两个角上的图标和它们之间的文本中显示。
这是另一个例子:
<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 class="has-header">
Some content!
</ion-content>
希望对你有帮助
编辑:
我看到你在使用标签应用,所以我找到了这个解决方案 here:
<ion-nav-buttons side="primary">
<button class="button" ng-click="doSomething()">
I'm a button on the primary of the navbar!
</button>
</ion-nav-buttons>
您可以尝试这样设置 'has-subheader' class
<ion-content class='has-header has-subheader'>
...
</ion-content>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<ion-view view-title="BBS">
<ion-header-bar class="bar bar-subheader">
<div class="button-bar">
<a class="button">web game</a>
<a class="button">mobile game</a>
</div>
</ion-header-bar>
<ion-content class="has-header">
</ion-content>
</ion-view>
尝试与 ion-nav-buttons
一起使用:
<ion-view title="ToDo">
<ion-nav-buttons side="right">
<button class="button" ng-click="newTask()">
NEW
</button>
</ion-nav-buttons>
<ion-content>
<ion-list>
<ion-item class="item-remove-animate item-avatar item-icon-right"
ng-repeat="chat in chats" type="item-text-wrap"
href="#/tab/chats/{{chat.id}}">
<img ng-src="{{chat.face}}">
<h2>{{chat.name}}</h2>
<p>{{chat.lastText}}</p>
<i class="icon ion-chevron-right icon-accessory"></i>
<ion-option-button class="button-assertive" ng-click="remove(chat)">
Delete
</ion-option-button>
</ion-item>
</ion-list>
</ion-content>
</ion-view>