An open API service indexing awesome lists of open source software.

https://github.com/lucas-labs/vue3-vsl

📜 Vuejs 3 virtual scroll list
https://github.com/lucas-labs/vue3-vsl

infinite-scroller scroller typescript virtual-list virtual-scroll virtual-scroller vuejs3

Last synced: 11 months ago
JSON representation

📜 Vuejs 3 virtual scroll list

Awesome Lists containing this project

README

          



🔎 @lucas-labs/vue3-vsl (virtual-scroll-list) is a Vuejs 3 component plugin. Heavily based on tangbc/vue-virtual-scroll-list. Basically the same but ported to Vuejs 3 + typescript + Composition API.

## Install

### npm
```bash
npm i @lucas-labs/vue3-vsl
```

### pnpm
```bash
pnpm i @lucas-labs/vue3-vsl
```

### yarn
```bash
yarn add @lucas-labs/vue3-vsl
```

## Usage

```vue

hello!



...



#{{ index }}

{{ item.id }} | {{ item.username }}





import { ref } from 'vue';
import { VirtualScroller } from '@lucas-labs/vue3-vsl';

const users = ref<{ id: number | string; username: string }[]>([]);

const fetchUsers = () => {
users.value = ...
};

const bottom = () => {
// we reached the bottom of the list...
// fetch more users maybe?
...
};

fetchUsers();

```

### Use globally

```typescript
// main.ts/main.js
import { createApp } from 'vue'
import App from './App.vue'

// import the plugin
import VirtualScrollerPlugin from '@lucas-labs/vue3-vsl';

const app = createApp(App);

// use the plugin to make it
// available in all your components
app.use(VirtualScrollerPlugin);
app.mount('#app');
```

# TODO

- [ ] Add tests!