Skip to content

ScrollView

Scrollable container with pull-to-refresh and reach-edge events.

Code examples

Vertical scrolling

Scroll Item 1
Scroll Item 2
Scroll Item 3
Scroll Item 4
Scroll Item 5
Scroll Item 6
Scroll Item 7
Scroll Item 8
Scroll Item 9
Scroll Item 10
Scroll Item 11
Scroll Item 12
Scroll Item 13
Scroll Item 14
Scroll Item 15
Scroll Item 16
Scroll Item 17
Scroll Item 18
Scroll Item 19
Scroll Item 20

Vertical scroll

Set a fixed height and enable `scroll-y`

Horizontal scrolling

Tag 1
Tag 2
Tag 3
Tag 4
Tag 5
Tag 6
Tag 7
Tag 8
Tag 9
Tag 10
Tag 11
Tag 12
Tag 13
Tag 14
Tag 15

Horizontal scroll

Use `scroll-x` for horizontal scrolling

API

Props

属性说明类型默认值
scroll-xEnable horizontal scrollingbooleanfalse
scroll-yEnable vertical scrollingbooleanfalse
scroll-topVertical scroll positionnumber0
scroll-leftHorizontal scroll positionnumber0
scroll-into-viewScroll to a child element by idstring-
upper-thresholdDistance from top to fire `scrolltoupper` (px)number50
lower-thresholdDistance from bottom to fire `scrolltolower` (px)number50
refresher-enabledEnable pull-to-refreshbooleanfalse

Events

属性说明类型默认值
scrollFires while scrolling{ scrollTop, scrollLeft, scrollHeight }-
scrolltoupperFires when the top or left edge is reached{ direction }-
scrolltolowerFires when the bottom or right edge is reached{ direction }-
refresherrefreshPull-to-refresh triggered--

MiniDev Studio — Mini-app Development Toolkit