我正在使用默认的 ion-tab-bar 和底部放置,如 LinkedIn 应用程序中所示。
我想在滚动时隐藏标签栏并在滚动停止时再次显示它。这个功能可以在LinkedIn应用程序中看到。
这是 tabs.page.html
<ion-tabs >
<ion-tab-bar slot="bottom" >
<ion-tab-button tab="tab1">
<ion-icon name="desktop"></ion-icon>
<ion-label>Tab Three</ion-label>
</ion-tab-button>
<ion-tab-button tab="tab2">
<ion-icon name="person"></ion-icon>
<ion-label>Tab Two</ion-label>
</ion-tab-button>
<ion-tab-button tab="tab3">
<ion-icon name="send"></ion-icon>
<ion-label>Tab Three</ion-label>
</ion-tab-button>
</ion-tab-bar>
</ion-tabs>
将其添加到tab.page.ts
ngOnInit() {
let content = document.querySelector('ion-content');
content.scrollEvents = true;
content.addEventListener('ionScrollStart', () => {
document.querySelector('ion-tab-bar').style.display = 'none';
});
content.addEventListener('ionScrollEnd', () => {
document.querySelector('ion-tab-bar').style.display = 'flex';
});
}
这就能解决问题...
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)