vue-无限滚动

<ul class="infinite-list" v-infinite-scroll="load" style="overflow:auto">
    <li v-for="i in data" class="infinite-list-item">{{ i.id }}</li>
</ul>

先拉出数据显示,每次往下滑动的时候在拉去pagesize+3

data() {
        return {
            data: [],
            will: "aaa",
            page: 10
        };
    },
    methods: {
        //拉取页面触发;
        load() {
            this.page += 3  ;
            this.aj();
        },
        aj() {
            this.axios
                .get("http://192.168.2.250/car?pagesize=" + this.page)
                .then(data => {
                    this.data = data.data.results;
                });
        }
    },
    created() {
        this.aj();
    }

喜欢的小伙伴可以关注我的微信公众号“前端伪大叔”

 

posted @ 2019-10-20 11:02  前端伪大叔  阅读(613)  评论(0编辑  收藏  举报