npm i best-scroll -S
import Vue from 'vue'
import scroll from 'best-scroll'
Vue.use(scroll)
<scroll
:on-refresh="refresh"
:on-infinite="infinite">
<!-- content goes here -->
</scroll>
Attr. Name | Description | Required | Default Value |
---|---|---|---|
onRefresh | pull to refresh callback | N | - |
onInfinite | infinite loading callback | N | - |
onScroll | Y-axis position callback | N | - |
scrollingComplete | scroll end callback | N | 滚动完毕回调 |
width | scroll container width | N | 100% |
height | scroll container height | N | 100% |
resize()
resize scroll content (deprecated, cause the scroll's content resizes self automatically)triggerPullToRefresh()
start pull-to-refresh manuallyfinishPullToRefresh()
stop pull-to-refreshfinishInfinite(isNoMoreData :Boolean)
stop infinite-loadingscrollTo(x:Integer, y:Integer, animate:Boolean)
scroll to a position in scroll contentscrollBy(x:Integer, y:Integer, animate:Boolean)
scroll by a position in scroll contentgetPosition :Object
get current position of scroll contentscrollElement(el, time, offsetX, offsetY, easing)
disable()
disable scrollingenable()
enable scrolling