Ionic6 mid-button效果实现

mid-button
简单实现这种mid-button

<1> tabs.page.html

<ion-tabs>

  <ion-fab vertical="bottom" horizontal="center" translucent="true">

    <ion-fab-button (click)="onClick()">

      <ion-icon name="camera"></ion-icon>

    </ion-fab-button>

  </ion-fab>
<ion-tab-bar slot="bottom" class="ion-no-border">

    <ion-tab-button tab="tab1">

      <ion-icon name="triangle"></ion-icon>

      <ion-label>Tab 1</ion-label>

    </ion-tab-button>

    <ion-tab-button tab="tab2" class="comments">

      <ion-icon name="ellipse"></ion-icon>

      <ion-label>Tab 2</ion-label>

    </ion-tab-button>



    <svg height="50" viewBox="0 0 100 50" width="100" xmlns="http://www.w3.org/2000/svg">

      <path d="M100 0v50H0V0c.543 27.153 22.72 49 50 49S99.457 27.153 99.99 0h.01z" fill="red" fill-rule="evenodd">

      </path>

    </svg>

    <ion-tab-button tab="tab3" class="notifs">

      <ion-icon name="square"></ion-icon>

      <ion-label>Tab 3</ion-label>

    </ion-tab-button>

    <ion-tab-button tab="mine">

      <ion-icon name="person"></ion-icon>

      <ion-label>Mine</ion-label>

    </ion-tab-button>

  </ion-tab-bar>

</ion-tabs>

<2> tabs.page.scss

ion-tabs {

    ion-fab {

        margin-bottom: env(safe-area-inset-bottom);

        /* fix notch ios*/

        ion-fab-button {

            --box-shadow: none;

        }

    }

    ion-tab-bar {

        --border: 0;

        --background: transparent;

        position: absolute;

        height: 50px;

        bottom: 0;

        left: 0;

        right: 0;

        width: 100%;

        &:after {

            content: " ";

            width: 100%;

            bottom: 0;

            background: var(--ion-color-light);

            height: env(safe-area-inset-bottom);

            position: absolute;

        }

        ion-tab-button {

            --background: var(--ion-color-light);

        }

        ion-tab-button.comments {

            margin-right: 0px;

            border-top-right-radius: 18px;

        }

        ion-tab-button.notifs {

            margin-left: 0px;

            border-top-left-radius: 18px;

        }

        svg {

            width: 75px;

            margin-top: 11px;

            path {

                fill: var(--ion-color-light);

            }

        }

    }

}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

尉迟泫承

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值