T泰达T
T泰达T
  • 发布:2025-11-19 10:40
  • 更新:16 分钟前
  • 阅读:32

scroll-view的高度100%不生效?

分类:uni-app
<view style="width: 90%;flex: 1;position: relative;">  
            <scroll-view :scroll-top="scrollTop" scroll-y="true"    style="width: 100%;height: 100%;">

按理说它的上层view是flex:1,scroll-view设置为100%不应该刚好铺满屏幕高度吗?但现在会把页面撑大呢?

2025-11-19 10:40 负责人:无 分享
已邀请:
爱豆豆

爱豆豆 - 办法总比困难多

不能用height: 100%; scroll-view必须要有一个固定高度 如果想要动态高度可以用vh 和calc() 来计算

爱tutu爱生活

爱tutu爱生活 - 前端渣渣

可以试一下,外面盒子position: fixed;top: 0px;right: 0px;bottom: 0px;left: 0px;
scroll-view的样式:position: absolute;top: 0;right: 0px;bottom: 0px;left: 0px;

jgj_app

jgj_app

scroll-view 设置 flex:1

要回复问题请先登录注册