页面树
页面树的结构。
页面树是一种树状结构,用于描述所有导航链接,以及分隔符和文件夹等其他项目。
🌐 Page tree is a tree structure that describes all navigation links, with other items like separator and folders.
它将被发送给客户端,并在包括侧边栏和面包屑在内的导航元素中引用。因此,你不应该在页面树中存储任何敏感或大型数据。
🌐 It will be sent to the client and being referenced in navigation elements including the sidebar and breadcrumb. Hence, you shouldn't store any sensitive or large data in page tree.
注意
按设计,页面树只包含所有页面和文件夹的必要信息。
🌐 By design, page tree only contains necessary information of all pages and folders.
无法序列化的数据(例如函数)无法传递到页面树。
🌐 Unserializable data such as functions can't be passed to page tree.
惯例
🌐 Conventions
你可以导入页面树的类型定义,如果你想硬编码或生成它,这会很有用。
🌐 You can import the type definitions of page tree, useful if you want to hardcode or generate it.
import type * as PageTree from 'fumadocs-core/page-tree';
const tree: PageTree.Root = {
// props
};某些节点包含 $ref 属性,它们是内部的,在硬编码时不会使用。
🌐 Certain nodes contain a $ref property, they are internal and not used when hardcoding it.
根
🌐 Root
页面树的初始根。
🌐 The initial root of page trees.
Prop
Type
页面
🌐 Page
表示链接的节点。
🌐 A node representing link.
{
"type": "page",
"name": "Quick Start",
"url": "/docs"
}也支持外部网址
Prop
Type
文件夹
🌐 Folder
包含多个子节点的节点。
🌐 A node containing multiple children nodes.
{
"type": "folder",
"name": "Guide",
"index": {
"type": "page",
...
}
"children": [
...
]
}Prop
Type
分隔符
🌐 Separator
项目之间的标签。
🌐 A label between items.
{
"type": "separator",
"name": "Components"
}Prop
Type
图标
🌐 Icons
图标是一个 ReactElement,可由页面和文件夹支持。
🌐 Icon is a ReactElement, supported by pages and folders.
Last updated on
