1.0.1 • Published 7 years ago

vue-scroll-refresh-loadmore v1.0.1

Weekly downloads
5
License
ISC
Repository
github
Last release
7 years ago

vue-scroll-refresh-loadmore

scroll for refresh an load more

npm.io

npm.io

START UP

INSTALL

npm install vue-scroll-refresh-loadmore --save

BASIC USE

<scroller
      @on-refresh="refresh"
      @on-loadmore="loadmore"
      ref="chatScroller">
   <item /> 
   <item />  
   <item />       
</scroller>
    

methods

methods: {
      refresh () {
        console.log('refresh')
        window.setTimeout(() => {
          this.$refs.chatScroller.refreshDone()
        }, 3000)
      },
      loadmore () {
        console.log('load more')
        window.setTimeout(() => {
          this.$refs.chatScroller.loadmoreDone()
        }, 3000)
      }
    },

props

propstyperequireddescriptiondefault
pulldownTextStringNtext show when pulling donePull down to refresh
onPulldownTextRelease to refresh
pulldownRefreshingTextloading...
scrollRefreshingTextfooter loading more textloading...
headerMaxHeightNumberin px50
footerMaxHeightin px30
refreshThresholdNumber0.5 means when pulldown distance >= 0.5 * headerMaxHeight ,that is enough for release refreshing0.5
loadMoreThresholdNumberthe distance (px) from bottom for loading more10
headerRefreshDisabledBooleanwhen set true, on-refresh will not emitfalse
footerLoadDisabledBooleanwhen set true, on-loadmore will not emitfalse

events

  • on-refresh: emit when pulldown a enough distance will not emit when refreshing, or headerRefreshDisabled === true ,must call the method refreshDone to reset

  • on-loadmore: emit when pullup to the bottom(or the loadMoreThreshold set) will not emit when refreshing, or footerLoadDisabled === true ,must call the method footerLoadDisabled to reset

methods

  • refreshDone: hide header loading reset header refreshing statu * scrollTop = 0
  • loadmoreDone: * reset footer loading