导航菜单
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>
类型定义
MenuVo
MenuVo
{
"metadata": {
"name": "string",
"labels": {
"additionalProp1": "string"
},
"annotations": {
"additionalProp1": "string"
},
"creationTimestamp": "2022-11-20T14:44:58.984Z",
},
"spec": {
"displayName": "string",
"menuItems": [
"string"
]
},
"menuItems": "List<#MenuItemVo>"
}
MenuItemVo
MenuItemVo
{
"metadata": {
"name": "string",
"labels": {
"additionalProp1": "string"
},
"annotations": {
"additionalProp1": "string"
},
"creationTimestamp": "2022-11-20T14:44:58.984Z",
},
"spec": {
"displayName": "string",
"href": "string",
"priority": 0,
"children": [
"string"
],
"categoryRef": {
"group": "string",
"version": "string",
"kind": "string",
"name": "string"
},
"tagRef": {
"group": "string",
"version": "string",
"kind": "string",
"name": "string"
},
"postRef": {
"group": "string",
"version": "string",
"kind": "string",
"name": "string"
},
"singlePageRef": {
"group": "string",
"version": "string",
"kind": "string",
"name": "string"
}
},
"status": {
"displayName": "string",
"href": "string"
},
"children": "List<#MenuItemVo>",
"parentName": "string",
}