mirror of
https://github.com/halo-dev/docs.git
synced 2026-01-28 01:09:02 +08:00
docs: update documentation for Halo 2.9 (#246)
为 Halo 2.9.0 更新文档。 /kind documentation ```release-note None ```
This commit is contained in:
@@ -0,0 +1,87 @@
|
||||
---
|
||||
title: 导航菜单
|
||||
description: 导航菜单 - MenuFinder
|
||||
---
|
||||
|
||||
import MenuItemVo from "../vo/MenuItemVo.md"
|
||||
import MenuVo from "../vo/MenuVo.md"
|
||||
|
||||
## getByName(name)
|
||||
|
||||
```js
|
||||
menuFinder.getByName(name)
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
根据 `metadata.name` 获取菜单。
|
||||
|
||||
### 参数
|
||||
|
||||
1. `name:string` - 菜单的唯一标识 `metadata.name`。
|
||||
|
||||
### 返回值
|
||||
|
||||
[#MenuVo](#menuvo)
|
||||
|
||||
### 示例
|
||||
|
||||
```html
|
||||
<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}"
|
||||
th:target="${menuItem.spec.target?.value}"
|
||||
>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
```
|
||||
|
||||
## getPrimary()
|
||||
|
||||
```js
|
||||
menuFinder.getPrimary()
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
获取主菜单。
|
||||
|
||||
### 参数
|
||||
|
||||
无
|
||||
|
||||
### 返回值
|
||||
|
||||
[#MenuVo](#menuvo)
|
||||
|
||||
### 示例
|
||||
|
||||
```html
|
||||
<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}"
|
||||
th:target="${menuItem.spec.target?.value}"
|
||||
>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
```
|
||||
|
||||
## 类型定义
|
||||
|
||||
### MenuVo
|
||||
|
||||
<MenuVo />
|
||||
|
||||
### MenuItemVo
|
||||
|
||||
<MenuItemVo />
|
||||
Reference in New Issue
Block a user