Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

tingle-scroller

Package Overview
Dependencies
Maintainers
3
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tingle-scroller

The `Scroller Component` for tinglejs

latest
Source
npmnpm
Version
0.1.1
Version published
Weekly downloads
3
-25%
Maintainers
3
Weekly downloads
 
Created
Source

tingle-scroller npm version

The Scroller Component for tinglejs.

TL;DR

Scroller 是对 iScroll 的 React 封装,用作滑动容器。内部 iScroll 的版本是 5.1.3。

Install

npm install tingle-scroller --save

Simple Usage

render() {
    return (
        <Scroller>
            <GroupList title={"列表标题1"}>
                <div className="tLH44 tPL10">aa</div>
                <div className="tLH44 tPL10">aa</div>
                <div className="tLH44 tPL10">aa</div>
                <div className="tLH44 tPL10">aa</div>
                <div className="tLH44 tPL10">aa</div>
                <div className="tLH44 tPL10">aa</div>
                <div className="tLH44 tPL10">aa</div>
                <div className="tLH44 tPL10">aa</div>
            </GroupList>
        </Scroller>
    );
}

Options 可用配置

配置项必填默认值功能/备注
classNameoptional-自定义样式类
autoRefreshoptionaltrue是否在内容变化时自动重新计算和渲染
minWidthoptional100%容器的最小宽度(为了避免容器宽度过小而显示不正常)
  • 不在列表中的其余参数全部传透给 iScroll,作为 iScroll 的初始化配置项。
<Scroller ref="sc" click={true} mouseWheel={false}></Scroller>

更多配置详见官网

  • 以 on 开头的参数全部作为事件挂载到 iScroll 实例上。
<Scroller ref="sc" onScrollEnd={t.handleScrollEnd.bind(t)}></Scroller>

相当于

t.refs.sc.scroller.on('scrollEnd', t.handleScrollEnd.bind(t));

更多事件详见官网

API 接口

可通过 ref 到的 component 实例的 .scroller 来获取 iScroll 实例,进而调用实例中的所有方法以及获取实例中的各种属性。

t.refs.sc.scroller.scrollTo(0, 100);

Keywords

tingle-scroller

FAQs

Package last updated on 11 Sep 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts