An infinite and pull scroller component for Vue.js
vue-pull-infinite-scroller is a native scrolling component that performs well in a webview, pull to refresh & infinite loading.
https://bb595700239.github.io/vue-pull-infinite-scroller/dist/example/index.html
npm i vue-pull-infinite-scroller -S
import Vue from 'vue'
import VuePullInfiniteScroller from 'vue-pull-infinite-scroller'
Vue.use(VuePullInfiniteScroller)
<pull-infinite-scroller
:on-refresh="refresh"
:on-infinite="infinite">
<!-- content goes here -->
</pull-infinite-scroller>
methods: {
refresh: function (done) {
// ajax
done();
},
infinite: function (done) {
// ajax
// success
// go on
done()
// end
done('end')
// error
done('error')
}
}
组件一定要设置固定高度
组件内包含另一种块滑动区域(如:amap)可以写在class为no_scroll
容器里
Attr. Name | Description | Required | Default Value |
---|---|---|---|
onRefresh | pull to refresh callback | N | - |
onInfinite | infinite loading callback | N | - |
reload()
reload scroller