Skip to content
프로젝트

lhlyu/vue-virtual-waterfall

GitHub에서 보기

소개

vue3 virtual waterfall component(Vue3虚拟瀑布流组件)

웹 및 앱 개발

이 수치를 측정하는 방법

측정된 스타 증가

in 24h
0
in 7 days
0
in 15 days
0
in 1 month
기록 수집 중

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original

vue-virtual-waterfall

A Vue 3 virtual waterfall component

npm Last Commit

中文文档

Example

Usage

pnpm add @lhlyu/vue-virtual-waterfall

  • Local import
import { VirtualWaterfall } from '@lhlyu/vue-virtual-waterfall'
  • Global import
import VueVirtualWaterfall from '@lhlyu/vue-virtual-waterfall'

app.use(VueVirtualWaterfall)
  • Usage
<template>
    <VirtualWaterfall
        :items="items"
        :calcItemHeight="calcItemHeight"
    >
        <template #default="{ item }: { item: ItemOption }">
            <div class="card">
                <img :src="item.img" />
            </div>
        </template>
    </VirtualWaterfall>
</template>
  • Nuxt3 Usage

demo

Attention!!!

The VirtualWaterfall component wants to implement a virtual list, and the container that wraps it must indicate a fixed height. The scrolling event can be bound to this container. If this component is hung under the body, the height of the body also needs to be specified. The scrolling event can be bound to the window

Documentation

  • Properties
Field Type Default Description
virtual boolean true Enable virtual list
rowKey string 'id' Key for v-for
enableCache boolean true enable cache
gap number 15 Gap between each item
padding number or string 15 or '15px 15px' Container's padding
preloadScreenCount [number, number] [0, 0] Preload screen count [above, below]
itemMinWidth number 220 Minimum width for each item
maxColumnCount number 10 Maximum number of columns
minColumnCount number 2 Minimum number of columns
items any[] [] Data
calcItemHeight (item: any, itemWidth: number) => number (item: any, itemWidth: number) => 250 Method to calculate item height
  • Slots
Event Type Description
default { item: any, index: number } Custom default content
  • Methods
Event Type Description
withItemSpaces (cb: (spaces: readonly SpaceOption[]) => Promise<void> | void) Read Item Spaces Info

관련 프로젝트 살펴보기

불러오는 중…