<view class="container">
<view>
<text>vertical scroll</text>
<scroll-view scroll-y class="scroll-view-y" scroll-top="{{scrollTop}}">
<view id="green" class="scroll-y-item bg_green"></view>
<view id="red" class="scroll-y-item bg_red"></view>
<view id="blue" class="scroll-y-item bg_blue"></view>
<view id="yellow" class="scroll-y-item bg_yellow"></view>
</scroll-view>
</view>
<view>
<text>horizontal scroll</text>
<scroll-view scroll-x class="scroll-view-x" style="width:100%">
<view class="scroll-view-x">
<view class="scroll-x-item bg_green"></view>
<view class="scroll-x-item bg_red"></view>
<view class="scroll-x-item bg_blue"></view>
<view class="scroll-x-item bg_yellow"></view>
</view>
</scroll-view>
</view>
</view>
.scroll-view-y {
height: 200px;
width: 100%;
}
.scroll-y-item {
height: 70px;
width: 100%;
}
.scroll-view-x {
width: 300px;
height: 100px;
display: flex;
overflow: scroll;
}
.scroll-x-item {
width: 95px;
height: 100%;
display: inline-table;
}
| 属性名 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| scroll-x | Boolean | false | 允许横向滚动 |
| scroll-y | Boolean | false | 允许纵向滚动 |
| upper-threshold | Number | 50 | 距顶部/左边多远时(单位px),触发 scrolltoupper 事件 |
| lower-threshold | Number | 50 | 距底部/右边多远时(单位px),触发 scrolltolower 事件 |
| scroll-top | Number | 设置竖向滚动条位置 | |
| scroll-left | Number | 设置横向滚动条位置 | |
| scroll-into-view | String | 值应为某子元素id(id不能以数字开头)。设置哪个方向可滚动,则在哪个方向滚动到该元素 | |
| scroll-with-animation | Boolean | false | 在设置滚动条位置时使用动画过渡 |
| enable-back-to-top | Boolean | false | iOS点击顶部状态栏、安卓双击标题栏时,滚动条返回顶部,只支持竖向 |
| bindscrolltoupper | EventHandle | 滚动到顶部/左边,会触发 scrolltoupper 事件 | |
| bindscrolltolower | EventHandle | 滚动到底部/右边,会触发 scrolltolower 事件 | |
| bindscroll | EventHandle | 滚动时触发,event.detail = {scrollLeft, scrollTop, scrollHeight, scrollWidth, deltaX, deltaY} |
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有