简体   繁体   English

如何使用 Ionic PWA 应用程序在移动 Web 客户端上隐藏选项卡

[英]How to hide Tabs in on Mobile Web client with Ionic PWA app

Tabs are perfect to have inside of iOS and Android apps, however having tabs on mobile web clients are not ideal because of the phone's bottom navigation bar.标签非常适合在 iOS 和 Android 应用程序中使用,但是在移动 web 客户端上具有标签并不理想,因为手机的底部导航栏。 An example is how Etsy and Amazon scrap the tabs in their mobile web clients.一个例子是 Etsy 和亚马逊如何在他们的移动 web 客户端中废弃标签。

How can tabs be hidden on an Ionic React application for the mobile web client?如何在移动 web 客户端的 Ionic React 应用程序上隐藏选项卡?

I imagine this will involve wrapping some sort of function or hook around the tabs with the below code.我想这将涉及包装某种 function 或使用以下代码钩住标签。

 <IonTabBar slot="bottom">
          <IonTabButton tab="tab1" href="/tab1">
            <IonIcon icon={home} />
            <IonLabel></IonLabel>
          </IonTabButton>
          <IonTabButton tab="tab2" href="/tab2">
            <IonIcon icon={cart} />
            <IonLabel></IonLabel>
          </IonTabButton>
          <IonTabButton tab="tab3" href="/tab3">
            <IonIcon icon={person} />
            <IonLabel></IonLabel>
          </IonTabButton>
          <IonTabButton tab="tab4" href="/tab4">
            <IonIcon icon={menuSharp} />
            <IonLabel></IonLabel>
          </IonTabButton>
        </IonTabBar>

Thank you for any unique insights or perspectives.感谢您提供任何独特的见解或观点。

Set a global variable tied to isPlatform('mobileweb');设置一个绑定到 isPlatform('mobileweb'); 的全局变量;

And then hide the tab panel based on this value.然后根据这个值隐藏标签面板。

https://ionicframework.com/docs/react/platform https://ionicframework.com/docs/react/platform

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM