屏幕底部的粘性按钮离子

Sticky button ionic at bottom of screen

我正在用 ionic 制作一个 Android 应用程序,我想知道如何制作一个粘性按钮,当用户向下滚动时它总是出现在屏幕底部。

您可以使用 footer 组件:

Footer is a root component of a page that sits at the bottom of the page. Footer can be a wrapper for ion-toolbar to make sure the content area is sized correctly.

<ion-content></ion-content>

<ion-footer>
  <ion-toolbar>
    <button ion-button text-only>Your Button</button>
  </ion-toolbar>
</ion-footer>

由于 ion-footer 位于 ion-content 外部 ,页脚将始终显示,即使页面内容很多并且用户位于页面顶部。


StackBlitz demo