1.0.4 • Published 5 years ago

vue-scroller-plus v1.0.4

Weekly downloads
23
License
-
Repository
github
Last release
5 years ago

Vue Scroller version vue

Vue Scroller is a foundational component of Vonic UI. In purpose of smooth scrolling, pull to refresh and infinite loading.

For vue 1.0, please refer to branch v1.

Demo

https://wangdahoo.github.io/vue-scroller/

How to use

npm i vue-scroller -S
/* ignore this if you include vue-scroller.js by <script> tag from a cdn, such as unpkg */
import Vue from 'vue'
import VueScroller from 'vue-scroller'
Vue.use(VueScroller)
<scroller 
  :on-refresh="refresh"
  :on-infinite="infinite">
  <!-- content goes here -->
</scroller>

Live Code on JsFiddle

Webpack project by vue-cli

https://github.com/wangdahoo/vue-scroller-demo

API

Scroller component attributes:

Attr. NameDescriptionRequiredDefault Value
onRefreshpull to refresh callbackN-
onInfiniteinfinite loading callbackN-
refreshTexttips of pull-to-refreshN下拉刷新
noDataTexttips of no-more-data when infinite-loading finishedN没有更多数据
widthscroller container widthN100%
heightscroller container heightN100%
snappingenable snapping modeNfalse
snappingWidthsnapping widthN100 (stand for 100px)
snappingHeightsnapping heightN100
refreshLayerColortext color of pull-to-refresh layerN#AAA
loadingLayerColortext color of infinite-loading layerN#AAA
minContentHeightmin content height (px) of scroll-contentN0

Scroller vm instance methods:

  • resize() resize scroller content (deprecated, cause the scroller's content resizes self automatically)
  • triggerPullToRefresh() start pull-to-refresh manually
  • finishPullToRefresh() stop pull-to-refresh
  • finishInfinite(isNoMoreData :Boolean) stop infinite-loading
  • scrollTo(x:Integer, y:Integer, animate:Boolean) scroll to a position in scroller content
  • scrollBy(x:Integer, y:Integer, animate:Boolean) scroll by a position in scroller content
  • getPosition :Object get current position of scroller content