# vinfinite-scroll-next

> infinite scroll component for Vue.js applications

Latest version **1.0.1** (published 2022-02-19) · 0 weekly downloads

## Install

```sh
npm install vinfinite-scroll-next
pnpm add vinfinite-scroll-next
yarn add vinfinite-scroll-next
bun add vinfinite-scroll-next
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2022-02-19 |
| First published | 2022-02-19 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=12 |
| Dependencies | 0 |
| Unpacked size | 13.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Amirhossein Shahbazi |
| Maintainers | amirhshahbazi |

## Links

- npm: https://www.npmjs.com/package/vinfinite-scroll-next
- npm.io page: https://npm.io/package/vinfinite-scroll-next

## Recent versions

- 1.0.1 (latest) — 2022-02-19
- 1.0.0 — 2022-02-19

## README

<p align="center">
    <img width="150" src="https://jsdev.best/vinfinite-scroll.png" alt="Vinfinite Scroll">
</p>

# Vinfinite Scroll

For the Vue2 version, go [here](https://github.com/amirhshahbazi/vinfinite-scroll).

> Infinite scroll component for Vue.js
- 🟩 Easy to use
- 🟩 SSR compatible
---

## Installation

```bash
yarn add vinfinite-scroll-next
# or using npm:
npm install vinfinite-scroll-next
```

---

## Usage

### Import the component
```js
import VinfiniteScrollNext from 'vinfinite-scroll-next'
```

### Add the component to the end of the list you want to use
Every time the scroll position reaches `vinfinite-scroll`, the `notifyEndReached` is invoked.
```js
  <div class="list">
    <div v-for="(item) in list" :key="item">
      {{ item }}
    </div>
    <vinfinite-scroll-next @notifyEndReached="notify"></vinfinite-scroll-next>
  </div>
```

### Add data to the previous list whenever scroll is reached (Composition API)
```js
    const notify = () => {
      list.value = list.value.concat(Array.from({length: 100}, (v, k) => k + 1 + list.value.length))
    }
```

## Complete example

```js
<template>
  <div class="list">
    <div v-for="(item) in list" :key="item">
      {{ item }}
    </div>
    <vinfinite-scroll-next @notifyEndReached="notify"></vinfinite-scroll-next>
  </div>
</template>

<script>
import VinfiniteScrollNext from 'vinfinite-scroll-next'
import { onMounted, ref } from "vue"

export default {
  name: 'App',
  components: {
    VinfiniteScrollNext
  },
  setup() {
    let list = ref([])

    onMounted(() => {
      list.value = Array.from({length: 100}, (v, k) => k + 1)
    })

    const notify = () => {
      list.value = list.value.concat(Array.from({length: 100}, (v, k) => k + 1 + list.value.length))
    }

    return {
      list, notify
    }
  }
}
</script>


```

---

## License

[MIT](http://opensource.org/licenses/MIT)

---
_Source: https://npm.io/package/vinfinite-scroll-next · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
