Skip to content

Commit

Permalink
添加导航栏菜单图标自定义配置
Browse files Browse the repository at this point in the history
  • Loading branch information
hsxyhao committed Mar 6, 2020
1 parent 7614cb3 commit 3492b05
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 4 deletions.
21 changes: 21 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,27 @@
"type": "input",
"note": "seo优化关键字"
},
{
"name": "menuIcon",
"label": "导航菜单图标",
"group": "特性",
"value": "auto",
"type": "radio",
"options": [
{
"label": "",
"value": "none"
},
{
"label": "默认",
"value": "default"
},
{
"label": "自动",
"value": "auto"
}],
"note": "无:导航菜单不会添加任何图标,默认:使用默认的图标,无法识别则不使用,自动:使用默认的图标,包含无法识别"
},
{
"name": "sideIsRight",
"label": "菜单栏是否开启右边显示",
Expand Down
19 changes: 15 additions & 4 deletions templates/_blocks/header.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,23 @@
<ul id="nav_ul">
<% menus.forEach(function(menu) { %>
<li class="nav-item <%= active && menu.link === link?'nav-item-active':'' %>">
<% if (menu.openType === 'External') { %>
<a href="<%= menu.link %>" target="_blank">
<i class="fa fa-<%= map.get(menu.link) || 'globe'%>"></i> <%= menu.name %>
<% let target = menu.openType === 'External'?'_blank':'_self' %>
<% if (site.customConfig.menuIcon === 'default') { %>
<% if (map.get(menu.link)) { %>
<a href="<%= menu.link %>" target="<%= target %>">
<i class="fa fa-<%= map.get(menu.link) %>"></i> <%= menu.name %>
</a>
<% } else { %>
<a href="<%= menu.link %>" target="<%= target %>">
<%= menu.name %>
</a>
<% } %>
<% } else if (site.customConfig.menuIcon === 'none') { %>
<a href="<%= menu.link %>" target="<%= target %>">
<%= menu.name %>
</a>
<% } else { %>
<a href="<%= menu.link %>">
<a href="<%= menu.link %>" target="<%= target %>">
<i class="fa fa-<%= map.get(menu.link) || 'globe'%>"></i> <%= menu.name %>
</a>
<% } %>
Expand Down

0 comments on commit 3492b05

Please sign in to comment.