vue-scroll-refresh-loadmore
v1.0.1
Published
a vue component, for scrolling to refresh and load infinite
Downloads
26
Maintainers
Readme
vue-scroll-refresh-loadmore
scroll for refresh an load more
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
|props|type|required|description|default|
|:---|:---|:---|:---|:---|:---|
|pulldownText|String|N|text show when pulling done|Pull down to refresh|
|onPulldownText||||Release to refresh|
|pulldownRefreshingText||||loading...|
|scrollRefreshingText|||footer loading more text|loading...|
|headerMaxHeight|Number||in px|50|
|footerMaxHeight|||in px|30|
|refreshThreshold|Number||0.5 means when pulldown distance >= 0.5 * headerMaxHeight ,that is enough for release refreshing|0.5|
|loadMoreThreshold| Number ||the distance (px) from bottom for loading more|10|
|headerRefreshDisabled|Boolean||when set true, on-refresh
will not emit|false|
|footerLoadDisabled|Boolean||when set true, on-loadmore
will not emit|false|
events
on-refresh:
- emit when pulldown a enough distance
- will not emit when refreshing, or
headerRefreshDisabled === true
,must call the methodrefreshDone
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 methodfooterLoadDisabled
to reset
methods
- refreshDone:
- hide header loading
- reset header refreshing statu
- scrollTop = 0
- loadmoreDone:
- reset footer loading