<template>
<view class="body">
<view class="nav-tab">123</view>
<view class="container">
<view class="sub-container">
<scroll-view scroll-y class="custom-scroll-view">
<view v-for="item of 1000 " class="item" :key="item">{{ item }}</view>
</scroll-view>
</view>
</view>
</view>
</template>
<style>
.body {
height: 100vh;
}
.nav-tab {
height: 100px;
background-color: red;
}
.container {
height: calc(100vh - 50px);
display: flex;
flex-flow: column nowrap;
}
.sub-container {
flex: 1;
position: relative;
}
.custom-scroll-view {
position: absolute;
left: 0;
right: 0;
bottom: 0;
top: 0;
}
.item {
height: 50px;
border-bottom: 1px solid #ccc;
}
</style>
// page.json
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "uni-app",
"navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8",
"titleNView": false,
"contentAdjust": "false",
"bounce": "none",
"safearea": {
"bottom": {
"offset": "none"
}
}
}
1 个回复
DCloud_UNI_LXH
不太清楚你描述的是什么意思。
整个页面被列表内元素撑开是什么意思?可否提供一个视频说明之类的。
运行了你的示例:
.nav-tab height:100px;
.container height: calc(100vh - 50px);
页面肯定会被撑高 50px 。
你可以尝试给
.custom-scroll-view
设置一个固定的高度看看表现如何