@ewtd/ewt-anchor

0.1.3 • Public • Published

USAGE

Install

$ npm i @ewtd/ewt

demo

import { Anchor } from '@ewtd/ewt';

const dataSource: [
  {
    title: 'string',
    element: document.getElementById('title'),
  },
  {
    title: <div>element</div>,
    element: this.refs.element,
  },
],

<Anchor
  style={{
    position: 'relative',
    right: 0,
    top: 0,
  }}
  dataSource={dataSource}
  active={0}
  initTop={0}
/>

API

参数 说明 类型 默认值
dataSource 锚点列表 array [{title: string / element, element: document.getElementById('##') / ref}]
style 自定义样式 object {position: 'fixed',top: 0,right: 0,width: '120px'}
active 初始化滚动位置 number 0
scrollState scrollIntoView滚动的配置参数 object {{behavior: 'smooth',block: 'start'}}
throttle 节流毫秒数 number 500
timeout scrollIntoView过程与滚动监听的间隔 number 1000
initTop 容器相对于窗口的距离(滚动计算是相对于window) number 0

Package Sidebar

Install

npm i @ewtd/ewt-anchor

Weekly Downloads

2

Version

0.1.3

License

MIT

Unpacked Size

91.6 kB

Total Files

11

Last publish

Collaborators

  • tangbei
  • fansolc
  • glynodejs
  • iceydu
  • koshi
  • yukap
  • jiaguishan
  • yangfenglin