离子更改仅一页的后退按钮图标 [英] Ionic Change back button icon for one page only
问题描述
使用app.module.ts,设置IonicModule.forRoot(MyApp,{backButtonIcon:close})会将我应用中的所有后退图标设置为关闭图标。但是,我想仅在应用程序的一个或两个页面中应用它,并保留其余的默认值,或者我选择的第三个图标。有没有人知道如何在不实现我自己的按钮和后面功能的功能的情况下做到这一点?
Using app.module.ts, setting IonicModule.forRoot(MyApp,{backButtonIcon:"close"}) will set all the back icons in my app to close icon. However, I want to apply this in only a page or two of the app, and keep the rest with the default, or maybe third icon I choose. Does anyone know how can that be done without implementing my own button and functions for the back functionality?
推荐答案
通过离子 - 在离子标题中的工具栏,它出现在默认的离子导航栏的顶部。所以这是一个解决方法,有一个自定义标题栏与我的关闭图标和我的自定义函数gotoHome()。
这是我发现为特定页面自定义导航栏的最佳方式。
By having an ion-toolbar in the ion-header, it appears on top of the default ion-navbar. So it is a workaround to have a custom header bar with my close icon and my custom function gotoHome(). That's the best way i found to customize the 'navbar' for a particular page.
<ion-header>
<ion-toolbar>
<ion-buttons left>
<button ion-button icon-only (click)="gotoHome()">
<ion-icon name="close"></ion-icon>
</button>
</ion-buttons>
<ion-title>Title</ion-title>
</ion-toolbar>
</ion-header>
<ion-content padding>
...
</ion-content>
这篇关于离子更改仅一页的后退按钮图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!