今天需求個類似得到app分類的功能,效果如圖:
左右分別滾動,互不干擾,先把簡單的布局和樣式搭好。
<view class="page"> <view class="flex_row"> <view class="nav_left" > <view style="height:1500rpx;">左側分類</view> </view> <view class="nav_right"> <view class="nav_right_top">右側頂部分類</view> <scroll-view class="nav_right_list" scroll-y="true"> <view style="height:1200rpx;">右側列表</view> </scroll-view> </view> </view> </view>
.flex_row{display: flex;flex-direction: row;} .nav_left{width: 25%;height:100vh;overflow-y:auto; } .nav_right{width: 75%;position: relative;} .nav_right .nav_right_top{padding-top:20rpx;position: fixed;top:0;right:0;width: 75%;height:80rpx;font-size:30rpx; border-bottom: 1px solid #dedede;display:flex;flex-direction:row;white-space: nowrap;background: #fff;z-index: 99} .nav_right_list{margin-top:80rpx;height:calc(100vh - 80rpx);}
簡單的效果已經出來了,往里面填充數據就好了。。
完整代碼: