You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1.3 KiB

title description
导航菜单 导航菜单 - MenuFinder

import MenuItemVo from "../vo/_MenuItemVo.md" import MenuVo from "../vo/_MenuVo.md"

getByName(name)

menuFinder.getByName(name)

描述

根据 metadata.name 获取菜单。

参数

  1. name:string - 菜单的唯一标识 metadata.name

返回值

#MenuVo

示例

<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.status.displayName}"
        th:target="${menuItem.spec.target?.value}"
      >
      </a>
    </li>
  </ul>
</div>

getPrimary()

menuFinder.getPrimary()

描述

获取主菜单。

参数

返回值

#MenuVo

示例

<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.status.displayName}"
        th:target="${menuItem.spec.target?.value}"
      >
      </a>
    </li>
  </ul>
</div>

类型定义

MenuVo

MenuItemVo