1.0.1 • Published 7 years ago

vscroller v1.0.1

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

vscroller

Install

npm install vscroller -S

How to use

<div id="app">
  <m-scroller 
    :on-refresh="refresh"
    :on-infinite="infinite"
    ref="my_scroller">
    <!-- content goes here -->

    <ul>
        <li v-for="item in items">{{item}}</li>
    </ul>
  </m-scroller>
</div>

<script>
import scroller from 'vscroller';
export default {            
    components: {
        'm-scroller': scroller
    },
    data () {
        items: []  
    },

    methods: {
        refresh: function(){

        },

        infinite: function(){
            this.fetchData();
        },

        fetchData: function(){
            //部分数据加载完成
            this.$refs.my_scroller && this.$refs.my_scroller.finishInfinite()

            //所有数据加载完成
            this.$refs.my_scroller && this.$refs.my_scroller.finishInfinite(true)
        }
    }
}
</script>