0.0.2 • Published 2 years ago

vue-infinite-scrolling v0.0.2

Weekly downloads
-
License
-
Repository
github
Last release
2 years ago

vue-infinite-scrolling

About

Vue component plugin for infinite-scrolling.

How to use:

!Note: For now it is compatible with Vue3 only.

You can install component like a plugin:

import { createApp } from 'vue'
import App from './App.vue'
import VueInfiniteScrolling from 'vue-infinite-scrolling';

const app = createApp(App);
app.use(VueInfiniteScrolling);
app.mount('#app');

Or you can import it locally inside yours one:

<script lang="ts">
import { VueInfiniteScrolling } from 'vue-infinite-scrolling';
</script>

<template>
  <ul>
    <li
      v-for="i in items"
      :key="i"
    >
      {{ i }}
    </li>

    <VueInfiniteScrolling
      v-bind="{
        isAppendedToBody: true,
        pagination,
        isLoading,
      }"
      @load-more="loadMore"
    />
  </ul>
</template>

Props

Prop nameTypeIs requiredDefault valueDescription
paginationObjecttrue-Interface VueInfiniteScrollingPagination { limit: number; offset: number; totalItems: number;}
isLoadingBooleantrue-Is list loading
isAppendedToBodyBooleanfalsefalseAdd scroll event listener to the body or to the list-element
listHeightStringfalse'100%'List-element max-hight
scrollOffsetNumberfalse100Scroll offset in px
scrollDirectionStringfalse'to-bottom'Enum VUE_INFINITE_SCROLLING_DIRECTION: 'to-bottom', 'to-top'
scrollGuardTimeoutNumberfalse100Scroll delay timeout to prevent large number of calls

Slots

Slot nameDescription
defaultDefault slot. Uses 'Loading...' sign by default.

Development

Project setup:

Requirements:

  • Node >= v16.14.2
  • npm >= 8.5.0

Install dependencies:

npm ci

Compile and Hot-Reload for Development

npm run dev

Type-Check, Compile and Minify for Production

npm run build

Run Unit Tests with Vitest

npm run test:unit

Lint with ESLint

npm run lint

Recommended IDE Setup

0.0.2

2 years ago

0.0.1-a

2 years ago

0.0.1

2 years ago