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

v1.3.0

Published

虚拟滚动列表

Downloads

2

Readme

virtual-scroll-list_ferying

虚拟滚动列表(react版本)

插件功能说明:

可满足列表元素固定、不固定、动态等情况的虚拟滚动列表

开发环境说明:

node: v16.13.2 react: v18.2

插件使用方式:

npm install virtual-scroll-list_ferying --save
<VirtualScrollList
    wrapperStyle={{ width: '300px', height: '400px' }} // 容器样式
    estimatedItemHeight={40} // 列表元素的高度;如果列表高度不固定,则此值为预估高度值,用作初始化时使用
    dataList={dataList} // 列表数据源
    >
    {(props: any) => {
        // 使用renderProps渲染列表的每项内容
        // record:object 当前列表项的所有信息
        // onChangeItem:function 操作动态高度列表时调用,用来更新缓存的列表信息
        const { record, onChangeItem } = props;

        return (
        <div className='row-item'>
            <header style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
            <h3>index_{record.index}</h3>
            // 动态操作展示的数据
            {record.content.length > 5 && (
                <>
                {record.showAll ? (
                    <button onClick={() => onChangeItem(record.index, 'close')}>收起</button>
                ) : (
                    <button onClick={() => onChangeItem(record.index, 'open')}>查看全部</button>
                )}
                </>
            )}
            </header>

            {record.showAll
            ? record.content.map((item: string, i: number) => <div key={i}>{item}</div>)
            : record.content.slice(0, 5).map((item, i) => <div key={i}>{item}</div>)}
        </div>
        );
    }}
</VirtualScrollList>

属性说明