mirror of
https://github.com/halo-dev/docs.git
synced 2025-10-25 04:06:26 +00:00
为 Halo 2.1 更新文档。 see https://github.com/halo-dev/halo/releases/tag/v2.1.0 /kind documentation ```release-note None ```
1.1 KiB
1.1 KiB
title, description
| title | description |
|---|---|
| 导航菜单 | 导航菜单 - MenuFinder |
import MenuItemVo from "../vo/MenuItemVo.md" import MenuVo from "../vo/MenuVo.md"
getByName(name)
menuFinder.getByName(name)
描述
根据 metadata.name 获取菜单。
参数
name:string- 菜单的唯一标识metadata.name。
返回值
示例
<div th:with="menu = ${menuFinder.getByName('menu-foo')}">
<ul th:with="menuItems = ${menu.menuItems}">
<li th:each="menuItem : ${menuItems}">
<a th:href="@{${menuItem.status.href}}" th:text="${menuItem.spec.displayName}"></a>
</li>
</ul>
</div>
getPrimary()
menuFinder.getPrimary()
描述
获取主菜单。
参数
无
返回值
示例
<div th:with="menu = ${menuFinder.getPrimary()}">
<ul th:with="menuItems = ${menu.menuItems}">
<li th:each="menuItem : ${menuItems}">
<a th:href="@{${menuItem.status.href}}" th:text="${menuItem.spec.displayName}"></a>
</li>
</ul>
</div>