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 🙏

© 2026 – Pkg Stats / Ryan Hefner

long-list-scroll-rem

v1.3.3

Published

A lightweight and high-performance Vue 3 virtual scrolling component designed to efficiently render long lists with dynamic rem-based sizing. Ideal for applications requiring smooth scrolling experiences and optimized rendering of large datasets.

Readme

📦 LongListScrollRem - 虚拟滚动长列表组件支持 rem

一个基于 Vue 3 的高性能虚拟滚动组件,适用于渲染大量数据的场景。通过仅渲染可视区域内的元素并结合 rem 动态计算高度,实现流畅的滚动体验。

🚀 🔍 特性

  • ✅ 虚拟滚动:只渲染当前可视区域内的列表项,提升性能。
  • 💡 动态高度支持:使用 rem 和传入的根字号进行高度计算,适配响应式布局。
  • 🧩 插槽支持:可自定义列表项内容。
  • 🎛️ 滚动控制:提供方法支持程序化滚动到指定位置(支持平滑滚动)。
  • 🌐 兼容 Vue 3 语法

📦 Installation

npm install long-list-scroll-rem

Or via yarn:

yarn add long-list-scroll-rem

🔧 Usage

1. 全局注册组件

// main.js or main.ts
import { createApp } from 'vue'
import App from './App.vue'

import LongListScrollRem from 'long-list-scroll-rem'

const app = createApp(App)

app.use(LongListScrollRem)

app.mount('#app')

局部注册使用

<template>
    <div class="list-container">
        <LongListScrollRem :list-data="data" :height="2" :root-font-size="16" key="id" ref="listRef">
            <template #default="{ item }">
                <div>{{ item.label }}</div>
            </template>
        </LongListScrollRem>
    </div>
</template>

<script setup>
import { ref } from 'vue'
import { LongListScrollRem } from 'long-list-scroll-rem'

const data = ref([
    { id: 0, label: 'Item 0' },
    { id: 1, label: 'Item 1' }
    // ...更多数据
])
const listRef = ref(null)

function scrollToIndex() {
    listRef.value.handleSrollTopSize({ index: 20 })
}
</script>

<style scoped>
.list-container {
    height: 500px;
    overflow: hidden;
}
</style>

⚙️ Props 参数说明

| Property | Type | Default | Description | | -------------- | ------ | ------- | ------------------------------------------------------------------------------------------------------------------------- | | listData | Array | [] | 列表数据数组,每个元素应包含唯一标识符字段 | | height | Number | 100 | 每个列表项的基础高度;rootFontSize=0 时,默认使用 html 根字号去计算每行高度;rootFontSize=1 时,默认每行高度为 height 值 | | rootFontSize | Number | 0 | 页面根字号(用于 rem 计算);当 为 0 时,默认使用 html 根字号去计算每行 height;当为 1 时,默认每行高度为出入的 height 值 | | key | String | id | 数据中作为唯一标识的字段名 |

🧪 组件通过 defineExpose 暴露了如下方法供父组件调用:handleSrollTopSize(options)滚动到指定的位置


handleSrollTopSize()

//默认传入参数
{
  top: 0,         // 滚动的目标位置
  behavior: 'smooth', // 滚动行为,如 'auto' 或 'smooth',可不配置默认为'smooth
  index: null     // 如果提供,则根据 index 计算 scrollTop, (优先级高于 top)
}

handleSrollTopSize 使用

listRef.value.handleSrollTopSize() //默认滚动到顶部,smooth滚动

listRef.value.handleSrollTopSize({ index: 10 }) // 滚动到第 10 项


listRef.value..handleSrollTopSize({ top: 500 })  // 滚动到 500px 位置

📜 License

MIT License