当前位置:网站首页>Short video mall system, how does scroll view adapt to the remaining height of the page
Short video mall system, how does scroll view adapt to the remaining height of the page
2022-06-24 22:13:00 【Yunbao network technology】
Short video mall system ,scroll-view How to adapt the remaining height of the page
onLoad(options){
uni.getSystemInfo({
success: (res) => {
// Get the height of the phone status bar
this.statusBarHeight = res.statusBarHeight;
this.scrollviewHeight = `calc(100vh - 98rpx - 110rpx - ${
this.statusBarHeight}px)`;
}
});
}
Add inline styles to labels :
<scroll-view class="chat-main"
scroll-y="true"
:scroll-into-view="scrollToView"
:scroll-with-animation="needScrollAnimation"
@scrolltoupper="debounce"
:style="{height:scrollviewHeight}">
</scroll-view>
But this method requires the use of js The calculation is not simple , have access to flex Layout , Set the spindle to y Axis , Then specify the height of the other two components ,scroll-view Area use flex:1 Highly adaptive . It should be noted that elements other than the adaptive region must specify the height , If there is no definite height, you can specify the relative height . And that is page Is the label that the applet wraps on the outermost layer by default , Also specify the height height:100%
<view class="box">
<top-bar class="box-head"></top-bar>
<scroll-view class="box-scroll"></scroll-view>
<bottom-bar class="box-bottom"></bottom-bar>
</view>
page{
height:100%;
}
.box {
display: flex;
flex-direction:column;
height:100vh; /* Height must be specified Or written 100%*/
overflow:hidden;
}
.box-head {
flex-shrink: 0;
height: 55px;
}
.box-scroll {
flex: 1;
overflow: scroll; /* This must be written */
height: 1px;
}
.box-bottom {
height:49px;
}
The above is the short video mall system ,scroll-view How to adapt the remaining height of the page , More content welcome to follow the article
边栏推荐
- 60 个神级 VS Code 插件!!
- Opengauss kernel: simple query execution
- 我国SaaS产业的发展趋势与路径
- Interviewer: you said you are proficient in redis. Have you seen the persistent configuration?
- Shutter precautions for using typedef
- 60 divine vs Code plug-ins!!
- 旅行商问题(TSP)的相关论文总结
- Reduce the pip to the specified version (upgrade the PIP through pycharm, and then reduce it to the original version)
- Double linked list implementation
- Machine learning: gradient descent method
猜你喜欢
随机推荐
Excel布局
ST表+二分
leetcode_ one thousand three hundred and sixty-five
linq查询集合类入门 案例武林高手类
Flutter: Unsupported value: false/true
Yida technology signed a contract with seven wolves to help the digital transformation of "Chinese men's wear leader"
socket done
Flutter: Unsupported value: false/true
60 个神级 VS Code 插件!!
[notes of Wu Enda] multivariable linear regression
树莓派初步使用
Application practice | massive data, second level analysis! Flink+doris build a real-time data warehouse scheme
You are using pip version 21.1.2; however, version 22.1.2 is available
LINQ query collection class introductory cases Wulin expert class
CV2 package guide times could not find a version that satisfies the requirement CV2 (from versions: none)
How does flutter use the online transcoding tool to convert JSON to model
壹沓科技签约七匹狼,助力「中国男装领导者」数字化转型
St Table + two points
降低pip到指定版本(通过PyCharm升级pip,在降低到原来版本)
You are using pip version 21.1.2; however, version 22.1.2 is available








