refreshable
v0.2.8
Published
a pull to refresh component for vue
Downloads
80
Maintainers
Readme
Refreshable
a pull to refresh component for vue
Installation
npm i refreshable
- globally
import Refreshable from 'refreshable'
import 'refreshable/dist/assets/refreshable.css'
Vue.use(Refreshable)
- partially
import { Refreshable } from 'refreshable'
import 'refreshable/dist/assets/refreshable.css'
<script>
components: {
Refreshable
}
</script>
Usage
- turn on pulldown or pullup simply
<refreshable ref="rf" :pulldown="true" :pullup="true" @pullingUp="doPullup" @pullingDown="doPulldown">
// your html
</refreshable>
- custom-built for your own
<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>
- closure funcs
- 3.1 endpoint
this.$refs.refreshable.endPullDown() // for pull down event
this.$refs.refreshable.endPullUp(hasMore: Boolean) // for pull up event
- 3.2 layout recalculate
this.$refs.refreshable.setNeedsLayout()
- 3.3 auto refresh
this.$refs.refreshable.autoRefresh()
- 3.4 resume pullUp
this.$refs.refreshable.resumePullUp()
Notice
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.