Scroller is a component which can have multiple child components in one column. It supports both direcitons. If the content size of child components exceeds the frame of the scroller, the whole child components will be scrollable.
Scroller supports all kinds of components, such as div, text, etc.
There are two special components that can only be used inside scroller component.
- refresh 0.6.1 used inside list to add pull-down-to-refresh functionality.
- loading 0.6.1 used inside list to add pull-up-to-load-more functionality.
- show-scrollbar: <boolean> true | false, default value is true. This attribute indicates whether show the scroll bar or not.
- scroll-direction: <string> the scroll direction of component, horizontal or vertical.
scroll-directiondefines the scrollable axis of scroller and
flex-directiondefines the layout axis of scroller.
flex-directionmust be set to the same direction, otherwise, undefined behavior may happen.
- Default value for
scroll-directionis vertical, and for
flex-directionis row .
flex-direction: rowwhen a horizontal layout and scrollable scroller is expected.
flex-direction: columnwhen a vertical layout and scrollable scroller is expected. But those two values are default, if you don’t set them, it also works fine.
- loadmoreoffset : <number> default value is 0. The loadmore event will be triggered when the list is loadmoreoffset left to reach the bottom. e.g. A list has total content length of 1000, and the loadmoreoffset is set to 400, the loadmore event will be triggered when 600 has beed scrolled and there is less than 400 left.
- loadmoreretry : <number> default value 0，whether to reset loadmore related UI when loadmore failed, will be deprecated in further release.
- offset-accuracy：<number> default value is 0, the vertical offset distance required to trigger the scroll event.
common styles: check out common styles for components
- support flexbox related styles
- support box model related styles
- support position related styles
- support opacity, background-color etc.
common events: check out the common events
clickevent. Check out common events
disappearevent. Check out common events
loadmoreevent should be used in concert with loadmoreoffset. If the view has less than loadmoreoffset to scroll down, the event will be triggered.See details in example.
scrollevent 0.12+ .The
scrollshould be used in concert with offset-accuracy. This event is fired when the list scrolls. The current contentOffset value is given in this event callback. See details in example.
scrollendevent 0.17+ .These events are fired when the list begins or ends scrolling.The current contentSize and contentOffset value are given in this event callback. See details in example
Nested lists or scrollers within the same direction are not supported. In other words. nested list/scroller must have different directions.
For example, a vertical list nested in a vertical list or scroller is not allowed. However, a vertical list nested in a horizontal list or scroller is legal.