这篇文章主要介绍了微信小程序之滚动视图容器的实现方法的相关资料,希望通过本文能帮助到大家,让大家掌握这部分内容,需要的朋友可以参考下
微信小程序之滚动视图容器的实现方法
直接上两种方案代码以及效果图:
方案支付系统对接mhkj331
这种方案是直接使用view,并设置overflow: scroll
1
2
3
4
5
6
wxml:
<view class=”container”>
<view class=”content” wx:for=”{支付系统对接mhkj33{11}}” wx:key=”item”>
{{item}}
</view>
</view>
wxss:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
.container {
po支付系统对接mhkj33sition: absolute;
left: 0;
top: 0;
width: 100%;
height: 100vh;
overflow: scroll;
padding-bottom: 20rpx;
bac支付系统对接mhkj33kground: #FD9494;
}
.content {
margin: 20rpx auto 0 auto;
width: 710rpx;
height: 300rpx;
background: #ddd;支付系统对接mhkj33
border-radius: 16rpx;
font-size: 80rpx;
line-height: 300rpx;
text-align: center;
}
效果图:
方案2
使用scroll-v支付系统对接mhkj33iew + container作为容器
wxml:
1
2
3
4
5
6
7
<scroll-view class=”main_container” scroll-y>
<view class=”container”>支付系统对接mhkj33
<view class=”content” wx:for=”{{11}}” wx:key=”item”>
{{item}}
</view>
</view>
</scroll-view>
wxss:
1
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
.main_container {
position: relative;
width: 750rpx;
height: 100支付系统对接mhkj33vh;
background: #FD9494;
}
.container {
position: absolute; /*使用absolute的原因是因为为了防止第一个子视图有margin-top时,造成顶支付系统对接mhkj33部留白的情况*/
left: 0;
top: 0;
width: 100%;
padding-bottom: 20rpx;
}
.content {
margin: 20rpx auto 0 auto;
width:支付系统对接mhkj33 710rpx;
height: 300rpx;
background: #ddd;
border-radius: 16rpx;
font-size: 80rpx;
line-height: 300rpx;
te支付系统对接mhkj33xt-align: center;
}
效果图:
对比结果:
因为iPhone上滚动会带有弹簧效果,所以方案1在滚动时会出现不流畅的现象。方案2就不会出现这种情况,而且滚动也是流畅的。
以上就是本文的支付系统对接mhkj33全部内容,希望对大家的学习有所帮助,更多相关内容请关注PHP中文网!
相关推荐:
以上就是关于微信小程序滚动视图容器的实现方法的详细内容,更多请支付系统对接mhkj33关注php中文网其它相关文章!
暂无评论内容