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

scrollpage-react

v1.0.8

Published

use to scroll page.

Downloads

4

Readme

scrollpage-react

我们在浏览淘宝(浏览商品),微信(好友列表,朋友圈),QQ(好友列表,空间)和百度图片的时候,需要对页面进行一定的性能优化。若是淘宝用户搜索的商品进行全部展示,会影响页面的性能,针对这个问题,可以选择设置overflow:scroll对相同的item进行懒加载等方法进行优化。本文使用滑动分页的方式进行懒加载,这样可以增加用户的体验,而且不影响页面的性能。

install

npm i scrollpage-react

parameter

| 参数 | 说明 | 类型 | 默认值 | | :--- | :--- | :--- | :--- | | container | 需要滚动的容器 | Function | window | | threshold | 设置滑动请求api的阈值 | Number | 300 | | loader | 设置等待效果 | Node | null | | hasmore | 是否还可以活动 | Boolean | true | | className | 设置的样式 | Object | {} | | style | 设置行内样式 | Object | {} |

Example Usage

import React from 'react';
import ScrollPage from 'scrollpage-react'
import List from './List'

class Main extends React.Component {

    constructor(props) {
        super(props);

        this.state = {
            pageStart:0,
            dataSource: new Array(20).fill(2),
        }

        this.loadMore = this.loadMore.bind(this);
    }

    loadMore() {
        // call api
        this.setState({
            dataSource: this.state.dataSource.concat(new Array(20).fill(2))
        })
    }


    render(){
        const { dataSource } = this.state;
        return (<ScrollPage
                    loadMore={this.loadMore}
                    threshold={300}
                    >
            <List dataSource={dataSource}/>
        </ScrollPage>)
    }
}