收藏
回答

自定义tabbar中间凸起部分的圆弧怎么做出来?

自定义的tabbar,中间凸起部分的圆弧怎么做出来?如图二是想要实现的效果,图一中红色框的圆弧要怎么实现?

wxml代码
<view class="tab-bar">
    <view class="tab-bar-border"></view>
    <view class="tab-bar-item" wx:for="{{selectList}}" wx:key="index" data-index="{{index}}" data-path="{{item.pagePath}}" data-selected="{{item.selected}}" bindtap="onwidthTap">
        <image class="cover-image" src="{{selected === item.selected ? item.selectedIconPath : item.iconPath}}"></image>
        <view class="cover-view" style="color:{{selected === item.selected ? selectedColor : color}}">{{item.text}}</view>
    </view>
</view>
<view class="indicator">
    <view class="indicator-border"></view>
    <view class="indicator-item">
        <image class="indicator-image" src="/images/jia.png"></image>
    </view>
    <view class="indicator-item-text">发布</view>
</view>

wxss代码

.tab-bar {
    position: fixed;
    bottom0;
    left0;
    right0;
    height120rpx;
    background-color: white;
    display: flex;
    padding-bottomenv(safe-area-inset-bottom);
    box-shadow0 0 5rpx 0 rgba(0000.33);
}
.tab-bar-item {
    flex1;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}
.cover-image {
    margin-bottom40rpx;
    width44rpx;
    height44rpx;
}
.tab-bar-item .cover-view {
    font-size34rpx;
    position: absolute;
    bottom10rpx;
    color#7A7E83;
}
.indicator {
    height70rpx;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.indicator-border {
    position: absolute;
    left50%;
    top: -50rpx;
    transformtranslate(-50%, -50%);
    border-radius50%;
    width80rpx;
    height80rpx;
    border7px solid #fff;
    box-shadow0 0 5rpx 0 rgba(0000.33);
    z-index: -1;
}
.indicator-item {
    position: absolute;
    left50%;
    top: -50rpx;
    transformtranslate(-50%, -50%);
    background#ff9f7f;
    border-radius50%;
    width80rpx;
    height80rpx;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    border7px solid #fff;
    z-index1;
}
.indicator-image {
    width80rpx;
    height80rpx;
    border-radius50%;
}
.indicator-item-text {
    font-size34rpx;
    z-index1;
    color#7A7E83;
    position: absolute;
    bottom10rpx;
}
回答关注问题邀请回答
收藏

3 个回答

  • Y.
    Y.
    星期三 10:43

    找一个 我这样的背景

    星期三 10:43
    有用
    回复 1
    • 蓝天☁
      蓝天☁
      发表于移动端
      星期三 10:44
      没办法就只能这样了
      星期三 10:44
      回复
  • 一笑皆春
    一笑皆春
    星期三 10:28

    这不很简单,中间的那个大的单独加个view设置圆形样式

    第二种方案设计一张图,不过不如自己view画出来

    星期三 10:28
    有用
    回复 4
    • 蓝天☁
      蓝天☁
      发表于移动端
      星期三 10:33
      中间那个大圆弄出来了,就是两边的小圆弧怎么弄出来
      星期三 10:33
      回复
    • 一笑皆春
      一笑皆春
      星期三 10:36回复蓝天☁
      我看还有阴影,你还是找设计一张图片吧,然后定位上
      星期三 10:36
      回复
    • 一笑皆春
      一笑皆春
      星期三 10:37回复蓝天☁
      或者是试试通过层叠z-index控制层级显示
      星期三 10:37
      回复
    • 蓝天☁
      蓝天☁
      发表于移动端
      星期三 10:41回复一笑皆春
      那个小圆弧弄了个内凹圆弧,就是阴影弄不出来,是不是小程序上实现不了这个内凹圆弧阴影,或者说弄一半圆圈,再弄一个内凹圆弧覆盖多余的阴影线条?
      星期三 10:41
      回复
  • 那一抹微笑😊穿透阳光
    那一抹微笑😊穿透阳光
    星期三 10:07

    最简单的方法就是,你把图片设计成图二的样子

    星期三 10:07
    有用
    回复 2
登录 后发表内容