mirror of
https://github.com/halo-dev/docs.git
synced 2025-10-22 10:58:56 +00:00
docs: add target attribute documentation for menu item (#191)
添加主题开发 - 导航菜单中关于 `target` 属性的文档 /kind documentation Fixes #190 ```release-note None ```
This commit is contained in:
@@ -30,9 +30,14 @@ menuFinder.getByName(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>
|
||||
<a
|
||||
th:href="@{${menuItem.status.href}}"
|
||||
th:text="${menuItem.spec.displayName}"
|
||||
th:target="${menuItem.spec.target?.value}"
|
||||
>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</ul>
|
||||
</div>
|
||||
```
|
||||
|
||||
@@ -60,9 +65,14 @@ 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>
|
||||
<a
|
||||
th:href="@{${menuItem.status.href}}"
|
||||
th:text="${menuItem.spec.displayName}"
|
||||
th:target="${menuItem.spec.target?.value}"
|
||||
>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</ul>
|
||||
</div>
|
||||
```
|
||||
|
||||
|
@@ -17,6 +17,7 @@
|
||||
"children": [ // 下级菜单项,菜单项的 metadata.name 集合
|
||||
"string"
|
||||
],
|
||||
"target": "#Target", // 菜单页面打开方式,枚举类型
|
||||
"targetRef": { // 与其他资源比如文章的关联,一般无需直接使用
|
||||
"group": "string",
|
||||
"version": "string",
|
||||
@@ -32,3 +33,12 @@
|
||||
"parentName": "string",
|
||||
}
|
||||
```
|
||||
|
||||
```java title="Target"
|
||||
enum Target {
|
||||
BLANK("_blank"), // 在新窗口打开
|
||||
SELF("_self"), // 在当前窗口打开
|
||||
PARENT("_parent"), // 在父窗口打开
|
||||
TOP("_top"); // 在顶级窗口打开
|
||||
}
|
||||
```
|
||||
|
Reference in New Issue
Block a user