a pull to refresh component for vue
a pull to refresh component for vue
npm i refreshable
import Refreshable from 'refreshable'
import 'refreshable/dist/assets/refreshable.css'
Vue.use(Refreshable)
import { Refreshable } from 'refreshable'
import 'refreshable/dist/assets/refreshable.css'
<script>
components: {
Refreshable
}
</script>
<refreshable ref="rf" :pulldown="true" :pullup="true" @pullingUp="doPullup" @pullingDown="doPulldown">
// your html
</refreshable>
<refreshable ref="rf" :pulldown="{
threshold: 50,
text: {
loading: 'loading for u',
normal: 'pull to refresh',
done: 'done'
},
img: 'random' // spinner/circular/dots/random(default)
}" :pullup="{
threshold: 10,
text: { loading: 'loading', done: 'done', normal: 'pull up and load more', noMore: 'all loaded' },
img: 'circular' // spinner/circular/dots/random(default)
}" @pullingUp="doPullup" @pullingDown="doPulldown">
// your html
</refreshable>
this.$refs.refreshable.endPullDown() // for pull down event
this.$refs.refreshable.endPullUp(hasMore: Boolean) // for pull up event
this.$refs.refreshable.setNeedsLayout()
this.$refs.refreshable.autoRefresh()
this.$refs.refreshable.resumePullUp()
your
fixed
component or dom element will not effects when wrapped in<refreshable>
cause of the dependency of the lib is base ontransform
. therefore, your should place allfixed
elements out of the wrapper.