小程序的横向二级顶部导航条,可以切换、拖动、二级定位在一级的下面,高度怎么办

在这里插入图片描述

项目场景:

**做一个小程序的横向二级顶部导航条,可以切换、拖动、二级定位在一级的下面**

问题描述:

我只能设置scroll-view的高度,不然不显示二级菜单
这是html代码

<view class="navbar-top">
    <scroll-view scroll-x class="top-navbar" style="height:{{offsetheight}}">
        <view class="navbar" style="background: {{ itemStyle.background }};"> 
            <view class="item" wx:for="{{dataList}}" wx:key="unique" data-id="{{ item.navigation_id }}" data-index="{{index}}" data-url='{{item.link_url}}' data-child="{{item.child}}" bindtap="selectNav" data-hidden = "{{item.hidden}}" >
                <text class="item item-text {{curNav==item.navigation_id ? 'active' : ''}}" style="color: {{ curNav==item.navigation_id ? itemStyle.selectColor : itemStyle.color }};border-bottom: 3px solid {{ curNav==item.navigation_id && hidden == true? itemStyle.selectColor : 'none' }}">{{item.name}}</text>
                <view style="position:relative" >
                    <view class="two-list {{curIndex>3?'kaoyou':''}}" id='theid' hidden="{{curIndex!==index}}" style="grid-template-columns:{{gridtemplatecolumns}}; display:{{curIndex == index ? 'grid' : 'none'}};background: {{ itemStyle.background }};border: 1px solid {{ itemStyle.background }};" wx:if="{{hidden}}">
                        <text wx:for="{{item.child}}" wx:for-item="twotab" wx:key="index" catchtap='navigationTo' data-url='{{ twotab.link_url}}'  class="list-details item-text" style="color:{{itemStyle.color}}">{{twotab.name}}</text>
                        <view class=" {{curIndex>2?'t-right':'top-t'}}" style="width: 0;height: 0;border-bottom: 8rpx solid {{ itemStyle.background }};border-right: 8rpx solid transparent;border-left: 8rpx solid transparent;"></view>
                    </view>
                </view>
            </view>
        </view>
    </scroll-view>
</view>
page {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.top-navbar {
    height: 400rpx;
    overflow-y: hidden;
    overflow-x: auto;
    /* background-color: #f4f4f4; */
}

::-webkit-scrollbar {
    width: 0;
    height: 0;
    color: transparent;
}

.navbar-top {
    position: fixed;
    top: 102rpx;
    /* z-index: 100; */
    width: 100%;
    white-space: nowrap;
    box-sizing: border-box;
}

.navbar {
    display: flex;
    padding: 0 25rpx;
    background-color: #f4f4f4;
}

.navbar .item {
    background-color: #f4f4f4 !important;
}

.navbar .item>.item-text {
    display: block;
    text-align: center;
    padding: 0 25rpx;
    line-height: 72rpx;
    font-size: 30rpx;
    color: #999;
    position: relative;
}

.navbar .item>.text.active {
    color: #333;
}

.two-list {
    margin-top: 14rpx;
    margin-left: 15rpx;
    border: 1px solid #b998d1 !important;
    border-radius: 6rpx;
    padding: 0 12rpx;
    background-color: #f4f4f4 !important;
    position: absolute;
    top: 0;
    display: grid;
    flex-wrap: wrap;
    grid-template-columns: 50% 50%;
}

.two-list.kaoyou {
    position: absolute;
    right: 0;
}

.two-list .top-t {
    position: absolute;
    background-size: 20rpx;
    top: -7rpx;
    left: 44rpx;
    transform: translateX(50%);
    width: 20rpx;
    height: 10rpx;
}

.two-list .t-right {
    position: absolute;
    background-size: 20rpx;
    top: -7rpx;
    right: 44rpx;
    transform: translateX(50%);
    width: 20rpx;
    height: 10rpx;
}

.hide {
    display: none;
}

.block {
    display: block;
}

.two-list .list-details {
    padding: 21rpx 30rpx;
    font-size: 26rpx;
    color: #87699d;
    line-height: 30rpx;
    display: inline-block;
    margin: 0 auto;
    /* margin-right: 20rpx; */
}

/* 第三次更改添加 */

.father {
    display: inline-block;
    height: 65rpx;
    line-height: 65rpx;
}

.twolist-scroll {
    position: fixed;
    top: 175rpx;
    display: inline-block;
    width: 100%;
    white-space: nowrap;
    border: 1rpx solid #000;
}

.two-list-item {
    position: relative !important;
    display: inline-block;
    margin-top: 14rpx;
    margin-left: 15rpx;
    border: 1px solid #b998d1 !important;
    border-radius: 6rpx;
    padding: 0 12rpx;
    background-color: #f4f4f4 !important;
    max-width: 680rpx;
    vertical-align: top;
}
.list-details {
    padding: 21rpx 30rpx;
    font-size: 26rpx;
    color: #87699d;
    line-height: 30rpx;
    display: inline-block;
    margin: 0 auto;
    float:left;
    /* margin-right: 20rpx; */
}

原因分析:

问题还没解决,因为导航要在最上层,设置高度就会遮盖底部操作,


解决方案:请求支援,未解决

设置了高度二级显示,但是有罩层,底下就点击不了了。
把高度关掉二级就不显示了

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值