TableOfContents
TableOfContents 组件用于显示页面内容的标题结构,自动检测页面中的标题元素,生成目录列表,并在用户滚动页面时高亮当前可见的标题。
基础用法
---
/**
* @component TableOfContentsBasic
* @description TableOfContents 组件基础用法示例
*/
import { TableOfContents } from '@coffic/cosy-ui';
---
<TableOfContents />
自定义用法
---
/**
* @component TableOfContentsCustom
* @description TableOfContents 组件自定义用法示例
*/
import { TableOfContents } from '@coffic/cosy-ui';
---
<TableOfContents title="章节导航" selector="h2, h3, h4" maxDepth={4} />