Vue Scroller

2.2.4 · maintenance · verified Tue Apr 21

Vue Scroller is a Vue 2 component designed to provide smooth scrolling capabilities, including features like pull-to-refresh and infinite loading. It served as a foundational component for the Vonic UI framework. The package is currently at version 2.2.4 on npm, with the last update approximately four years ago. This indicates that it is tailored specifically for Vue 2 environments and is not actively maintained for compatibility with Vue 3 or newer ecosystems. Its primary differentiators lie in its straightforward API for implementing common mobile-like scrolling patterns within Vue 2 applications. Due to its age, new projects are generally advised to seek more modern, actively maintained alternatives, especially if targeting Vue 3.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates basic setup, pull-to-refresh, and infinite loading functionality within a Vue 2 application using a global component registration.

import Vue from 'vue';
import VueScroller from 'vue-scroller';

Vue.use(VueScroller);

new Vue({
  el: '#app',
  template: `
    <div style="height: 300px; border: 1px solid #ccc;">
      <scroller 
        :on-refresh="refresh" 
        :on-infinite="infinite"
        height="100%"
      >
        <p v-for="item in items" :key="item">{{ item }}</p>
      </scroller>
    </div>
  `,
  data: {
    items: []
  },
  methods: {
    refresh(done) {
      console.log('Refreshing data...');
      setTimeout(() => {
        this.items = Array.from({ length: 20 }, (_, i) => `Refreshed Item ${i + 1}`);
        done(); // Signal that refresh is complete
      }, 1500);
    },
    infinite(done) {
      console.log('Loading more data...');
      setTimeout(() => {
        const newItems = Array.from({ length: 10 }, (_, i) => `Loaded Item ${this.items.length + i + 1}`);
        this.items.push(...newItems);
        if (this.items.length >= 50) {
          done(true); // Signal no more data
        } else {
          done(); // Signal loading is complete
        }
      }, 1000);
    }
  },
  mounted() {
    this.refresh(() => {}); // Initial load
  }
});

view raw JSON →