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

virtual-seamless-scrolling

v1.0.9

Published

vue虚拟滚无缝动组件

Downloads

72

Readme

virtual-seamless-scrolling

介绍

vue3 虚拟无缝滚动列表,可以展示大量列表 其他框架的请自行下载源码进行修改

软件架构

支持vue2.7+ vue2.7 以下需安装 cnpm i @vue/composition-api -S

安装教程

npm install git+https://gitee.com/strivelei/virtual-list-scroll.git -S

或者

npm install virtual-seamless-scrolling -S

pnpm install virtual-seamless-scrolling -S
cnpm install virtual-seamless-scrolling -S

组件说明

  • 不定高无限滚动加载虚拟列表的实现,控制列表渲染数据量的同时实现列表无限滚动

使用说明demo 详情请查看 examples/App.vue


<template>
  <template>
    <h1>目前数据量{{dataSource.length}}</h1>
    <div class="virtual-list-content">
      <ListHeader :titleList="titleList"/>
      <VirtualListScroll
          data-key="project_id"
          :data-source="dataSource"
          :loading="loading"
          :interval="3000"
          @scroll-end="scrollEnd"
          @line-scroll-end="lineScrollEnd"
          class="virtual-list"
      >
        <template #item="{ item }">
          <el-tooltip placement="top" color="rgba(73, 146, 255, 0.8)"      :popper-options="{
      modifiers: [
        {
          name: 'computeStyles',
          options: {
            adaptive: false,
            enabled: false,
          },
        },
      ],
    }">
            <template #content>
              <span>项目名:{{ item.name }}</span>
            </template>
            <div class="virtual-list-item" @click="handelClick(<DataItem>item)">
              <span class="virtual-list-item-col">{{ item.name }}</span>
              <span class="virtual-list-item-col">{{ item.influence }}</span>
              <span class="virtual-list-item-col">{{ item.trend }}</span>
              <span class="virtual-list-item-col">{{ item.response }}</span>
              <span class="virtual-list-item-col">{{ item.activity }}</span>
              <span class="virtual-list-item-col">{{ item.github }}</span>
            </div>
          </el-tooltip>
        </template>
      </VirtualListScroll>


    </div>
  </template>
</template>

<script setup lang="ts">
  import {VirtualListScroll, ListHeader, TitltListItem} from 'virtual-seamless-scrolling'
  // 注意样式不用忘记引用了
  import 'virtual-seamless-scrolling/dist/style.css';
  import {ref} from "vue";

  // 列表字段
  const titleList: TitltListItem[] = [
    {
      label: '项目名',
      width: '20%'
    },
    {
      label: '影响力',
      width: '16%'
    },
    {
      label: '发展趋势',
      width: '16%'
    },
    {
      label: '社区反应',
      width: '16%'
    },
    {
      label: '开发活跃度',
      width: '16%'
    },
    {
      label: '指数',
      width: '16%'
    }
  ];
  const loading = ref(true)
  type DataItem = {
    project_id: number;
    influence: string;
    response: string;
    activity: string;
    trend: string;
    github: string;
    name: string;
  };
  // 数据员
  const dataSource = ref<DataItem[]>([])
  // 模拟请求
  setTimeout(() => {


    for (let i = 0; i < 35; i++) {
      dataSource.value.push({
        "project_id": i,
        "influence": (58.42 * (i /10) + ''),
        "response": "31.40",
        "activity": "79.34",
        "trend": "68.78",
        "github": "60.31",
        "name": "Automattic/wp-calypso" + i
      })
    }
    loading.value = false
  }, 100)

  /**
   * 滚动完成
   */
  const scrollEnd = () => {
    // 滚动完成后复制一份数据
    console.log('列表滚动到底部触发的方法')
  }


  /**
   * 单行滚动完成
   */
  const lineScrollEnd =() => {
    console.log('单行滚动完成')
  }
  const handelClick = (item: DataItem) => {
    console.log('点击事件', item)
  }
</script>


<style scoped lang="scss">

  .virtual-list-content {
    display: flex;
    flex-direction: column;
    height: 500px;
    padding: 0 8px;
    background-color: #0a54ea;

    .virtual-list-item {
      display: flex;
      gap: 8px;
      align-items: center;
      padding: 4px;
      //height: 80px;
      color: rgb(255 255 255);
      cursor: pointer;

      &:hover {
        color: #68d8ff;
        background: rgb(255 255 255 / 10%);
      }

      &-col {
        width: 16%;
        overflow: hidden;
        text-align: center;
        text-overflow: ellipsis;
        white-space: nowrap;
      }

      &-col:nth-child(1) {
        width: 19.5%;
        text-align: left;
      }
    }
  }
</style>

如果有其他需求可以在gitee上提出,后续会新增和优化