## 安装 ```bash npm install @pluve/scroll-anchor
npm install @pluve/scroll-anchorbash
npm install @pluve/scroll-anchoryarn add @pluve/scroll-anchor
`组件介绍
H5平台的双向锚点组件,可以为页面滚动提供锚点定位,提供功能包括
- 双向锚点
- 自动吸顶
- 动态高度支持
- 内容嵌套
使用
`jsxconst navKey = [
{ key: 'h1', name: 'test1' },
{ key: 'h2', name: 'test2' },
{ key: 'h3', name: 'test3' },
{ key: 'h4', name: 'test4' },
{ key: 'h5', name: 'test5' },
{ key: 'h6', name: 'test6' },
{ key: 'h7', name: 'test7' },
];
you content
you content
you content
you content
you content
you content
you content
`以上为组件的使用方式,组件内部使用Context维护数据,默认情况下,只使用单一数据源,即默认KEY使用,
在嵌套模式下,需要进行Key的指定,即同时存在多个
ScrollAnchor的情况下,需要指定anchorKey
`jsx
...
`在
ScrollAnchorItem中同样需要使用belongTo来指定归属关系`jsx
...
`
在组件ScrollAnchorItem中,scrollKey用于指定锚点,需要和导航内的key`对应