Skip to main content

PostToc

Function PostToc 

Source
pub fn PostToc(props: PostTocProps) -> impl IntoView
Expand description

文章目录(Table of Contents)组件。

Props:

  • toc_html:服务端生成的目录 HTML 字符串
  • title:目录标题,默认「目录」
  • nav_id、content_id、scroll_id:可选的图鉴局部作用域(省略即不传, 不要传 Some(..));正式文章使用默认的页面目录和窗口滚动。

组件函数体只运行一次:切文章时由调用方按 slug 重建本组件, 重建会重跑初始化(__initTocSidebar 幂等,先 dispose 上一次的 observer 与激活态)。

§Required Props

§Optional Props

  • title: [&'static str]
  • nav_id: [&'static str]
  • content_id: [&'static str]
  • scroll_id: [&'static str]