请大牛们帮忙研究一下
<view class="cates">
<searchinput></searchinput>
<view class="cates_container">
<!--左侧菜单栏-->
<scroll-view scroll-y="true" class="left_menu">
<view class="menu_item {{curNav===item.catId?'active':''}}"
wx:for="{{zongcatList}}"
wx:key="*this"
bindtap="handleItemTap"
data-index="{{index}}"
data-id="{{item.catId}}"
>
{{item.catName}}
</view>
</scroll-view>
<!--右侧商品内容-->
<scroll-view scroll-y="true" class="right_content">
<view class="goods_group"
wx:for="{{zongcatList[curindex].rcatlist}}"
wx:for-item="item1"
wx:key="index"
>
<view class="goods_title">
<text class="title_name">{{item1.catName}}</text>
</view>
<view class="goods_list">
<navigator
wx:for="{{item1.catList}}"
wx:for-item="item2"
wx:key="catId"
>
<image mode="widthFix" src="{{item2.catUrl}}"></image>
</navigator>
</view>
</view>
</scroll-view>
</view>
</view>
page {
height: 100%;
}
.cates {
height: 100%;
}
.cates_container {
height: clac(100vh - 180rpx);
display: flex;
}
.left_menu {
flex: 2;
}
.menu_item {
height: 80rpx;
display: flex;
justify-content: center;
align-items: center;
font-size: 30rpx;
}
.active{
color: var(--themeColor);
border-left: 5rpx solid currentColor;
background: #F8F8FF;
}
.right_content {
flex: 5;
background: #F8F8FF;
}
.goods_title {
height: 80rpx;
display: flex;
justify-content: center;
padding: 20rpx 0rpx;
}
.title_name{
color:#12f334;
font-size: 12px;
}
.goods_list {
display: flex;
flex-wrap: wrap;
}
.goods_list navigator {
width: 33.33%;
text-align: center;
}
.goods_list navigator image {
width: 50%;
}
估计是同款b站教程,我也遇到这个问题,然后稍微搜了一下,发现是要加高度才能实现那种效果。然后我就在左右两块分别加了height:100vh,也就是100视口高度,完美解决问题!
计算高度的地方字母顺序错了兄弟,应该是吧calc( 100vh - 180rpx )
高度固定
麻烦提供能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)