Giter Site home page Giter Site logo

zhuh0 / vue-virtual-waterfall Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lhlyu/vue-virtual-waterfall

0.0 0.0 0.0 3.11 MB

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

Home Page: https://waterfall.tatakai.top

License: MIT License

Shell 2.01% JavaScript 0.97% TypeScript 24.39% HTML 2.71% Vue 69.92%

vue-virtual-waterfall's Introduction

vue-virtual-waterfall

A Vue 3 virtual waterfall component

npm

中文文档

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
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

vue-virtual-waterfall's People

Contributors

lhlyu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.