Skip to content

Установка

Требования

Требуется Vue 3.3+. Других runtime-зависимостей нет — у пакета нулевые зависимости собственные.

Установка

bash
npm install vue-virtual-scroller-kit

Peer-зависимость:

bash
npm install vue@>=3.3

Быстрый старт

vue
<script setup lang="ts">
import { VirtualList } from 'vue-virtual-scroller-kit'

interface Row {
  id: number
  text: string
}

const items: Row[] = Array.from({ length: 100_000 }, (_, i) => ({
  id: i,
  text: `Row ${i + 1}`,
}))
</script>

<template>
  <VirtualList :items="items" :estimated-item-size="48" style="height: 600px">
    <template #default="{ item, index }">
      <div style="padding: 12px 16px; border-bottom: 1px solid #eee">
        {{ index + 1 }}. {{ item.text }}
      </div>
    </template>
  </VirtualList>
</template>