npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

lite-virtual-list

v0.1.7

Published

a vue components support waterfall flow and have large data lists with high scrolling performance

Downloads

29

Readme

lite-virtual-list

version last commit issues

Virtual list component library supporting waterfall flow based on Vue

  • Support fixed height

  • Support variable height

  • Support two column waterfall flow layout

  • Support DOM multi screen configuration

  • Support status selection

  • Support data dynamic appending

  • Support dynamic deletion of data

中文文档

Document:https://wensiyuanseven.github.io/lite-virtual-list

Example:https://wensiyuanseven.github.io/lite-virtual-list/example

Use

Install

npm install lite-virtual-list

Use

import liteVirtualList from "lite-virtual-list"

Vue.use(liteVirtualList)
<template>
  <lite-virtual-list type="fixed" :size="80" :remain="8" :data="items">
    <div slot-scope="{ item }" style="height: 80px">{{ item.value }}</div>
  </lite-virtual-list>
</template>
<script>
    let items = []
    let count = 1000
    for (let i = 0; i < count; i++) {
        items.push({ id: i, value: i })
    }
    export default {
        data() {
            return { items }
        }
    }
</script>

Props

| Props | Type |Default| Required | Description | |:---------|:------|:-----------|:------------|:---------------------------------------- | data | Array |[ ]| ✓ | Data source: each item in the data source must be an object, and each item must pass in a unique ID value {ID: number \| string}. When the type iswaterfall, each item passes in the height field {height: number \| string}, that is, the height of each item| | type | String | | ✓ | Type: three types can be specified: fixed ,variable, waterfall. Fixed: the height of the item is a fixed value. Variable: the height of the item supports the waterfall layout according to the content | | remain | Number | String | | ✓ | Number of visible data per screen | | size | Number | String | | | Size is the height of each item. When type is fixed or variable, size is required. When type is variable, size will be used as the default height of each item. After DOM rendering, the default height will be replaced by the real height | | screen | Array | [ 1 , 1 ]| | The number of screens rendered before and after the viewable area. The default value is [1,1], rendering one screen before and one screen after the viewable area. Example: screen = [2,3] means that two screens are rendered in front of the viewable area and three screens are rendered behind the viewable area. | | distance | Number | String |50| | The distance to trigger the loadmore callback when the page scrolls. The default is 50 | | interval | Number | String | 0| | Scroll event trigger interval, default is 0 | | virtualHieght | String | 100%| | The height of the virtual list is' 100% 'by default. When the type is fixed, the height will be calculated dynamically according to the size and remain attributes. This value is not required to be passed in. When the type is variable or waterfall, if this property is not passed in, the external container must declare a height value. | | unit | String | px | | Unit, default is PX | | deleteId | Number | String | | | When dynamically deleting an item, the ID value of the current item needs to be passed in. When the type is fixed, the deletion ID is not passed in, and the current item is deleted directly this.data.splice (index, 1)delete is OK. At this time, the high value will be calculated dynamically | marginBottom | Number | String | 0 | | The distance between items. This property is provided only when type is waterfall. It is invalid when type is fixed or variable |

Slot

 <lite-virtual-list >
   <!-- The default slot can get the data of each item-->
   <template slot="default" slot-scope="{ item }" >
      <div>{{item.id}}</div>
   </template>

   <!-- bottom -->
   <template slot="bottom">
     <div>Loading...</div>
   </template>
 </lite-virtual-list>

Event

scroll

Triggered when page scrolls

The callback returns an object

When the type is fixed or variable, the object contains the following properties:

  • scrollTop : How far the page scrolls

  • renderScrollTop : Distance between the render area and the page scroll

  • renderData : Data rendered while scrolling

When the type is waterfall, the object contains the following properties:

  • scrollTop : How far the page scrolls
  • renderLeftScrollTop : Distance between the data rendering area in the left column and the page scrolling
  • renderRightScrollTop : Distance between the right column data rendering area and the page scrolling
  • renderLeftData : Left column scrolls the rendered data
  • renderLeftData : Right column scrolls the rendered data

domUpdateSuccess

Trigger after DOM rendering to page

When the type is fixed or variable, the callback will return

renderData : Data rendered to the page

When the type is variable, the callback will return an object containing the following properties:

  • renderLeftData : Left column scrolls the rendered data
  • renderLeftData : Right column scrolls the rendered data

loadMore

This callback is triggered when the page scrolls to the bottom. You can configure how far it is from the bottom in combination with the 'distance' property. The default value is 50

deleteSuccess

Dynamic deletion of an item will be triggered after success, and the callback will return the data of the currently deleted item