umijs / dumi

📖 Static Site Generator for component library development
https://d.umijs.org
MIT License
3.58k stars 1.18k forks source link

左侧目录导航 #1884

Closed cangsnage closed 1 year ago

cangsnage commented 1 year ago

Question

左侧目录导航的数据是怎么获取的,

Sample Code

image 我看用的是这个组件,但是我想自定义目录导航的样式和布局问题,想自己写一个组件,想问下这个目录导航数据是怎么获取的呢, image

PeachScript commented 1 year ago

参考内置的 slot 实现即可:https://github.com/umijs/dumi/blob/72ece4cb622947bef82624111ca2ac62d98f6121/src/client/theme-default/slots/Sidebar/index.tsx#L9

cangsnage commented 1 year ago

参考内置的 slot 实现即可:

https://github.com/umijs/dumi/blob/72ece4cb622947bef82624111ca2ac62d98f6121/src/client/theme-default/slots/Sidebar/index.tsx#L9

image 获取只有头部导航栏的数据,我想获取markdown里面导航栏的数据 image

PeachScript commented 1 year ago

这个是 TOC,对应的 slot:https://github.com/umijs/dumi/blob/77941aa6dac393145efc48550765985aa1bea98f/src/client/theme-default/slots/Toc/index.tsx#L55