Skip to content

Commit

Permalink
[fix] key not exist error
Browse files Browse the repository at this point in the history
  • Loading branch information
expoli committed Oct 29, 2023
1 parent fd29df3 commit 61f014e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions themes/hexo/components/MenuGroupCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ const MenuGroupCard = (props) => {
{ name: locale.COMMON.TAGS, to: '/tag', slot: tagSlot, show: CONFIG.MENU_TAG }
]

for (let i = 0; i < links.length; i++) {
if (links[i].id !== i) {
links[i].id = i
}
}

return (
<nav id='nav' className='leading-8 flex justify-center dark:text-gray-200 w-full'>
{links.map(link => {
Expand Down
6 changes: 6 additions & 0 deletions themes/hexo/components/MenuListSide.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ export const MenuListSide = (props) => {
if (customNav) {
links = customNav.concat(links)
}

for (let i = 0; i < links.length; i++) {
if (links[i].id !== i) {
links[i].id = i
}
}

// 如果 开启自定义菜单,则覆盖Page生成的菜单
if (BLOG.CUSTOM_MENU) {
Expand Down
6 changes: 6 additions & 0 deletions themes/hexo/components/MenuListTop.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ export const MenuListTop = (props) => {
links = links.concat(customNav)
}

for (let i = 0; i < links.length; i++) {
if (links[i].id !== i) {
links[i].id = i
}
}

// 如果 开启自定义菜单,则覆盖Page生成的菜单
if (BLOG.CUSTOM_MENU) {
links = customMenu
Expand Down

0 comments on commit 61f014e

Please sign in to comment.