离子更改后退按钮图标仅适用于一页 [英] Ionic Change back button icon for one page only

查看:20
本文介绍了离子更改后退按钮图标仅适用于一页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 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?

推荐答案

通过在 ion-header 中有一个 ion-toolbar,它会出现在默认 ion-navbar 的顶部.因此,有一个带有我的关闭图标和我的自定义函数 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆