template如下,注意需要给height(滚动区域的):
<scroll-view style="height:100vh;" :scroll-y="QueryData.hasMore" @scrolltolower="QueryData.QueryFun(QueryData.params, true)">
<view class="ContentBox">
<!--占位-->
<view class="top"></view>
<ScrollItemList ></ScrollItemList >
</view>
</scroll-view>
css如下:
// 占位高度,同页面顶部固定内容
.top {
height: 220rpx;
}
// 修改uni自带滚动样式
>>>.uni-scroll-view {
overflow: auto !important;
}
我发现,固定内容的占位元素写在scroll-view的外面,会有随滚动页面一同滚动出页面的问题。