菜单bug

This commit is contained in:
tangly1024.com
2024-02-04 17:49:18 +08:00
parent 0b91bfb211
commit e904b47e76
3 changed files with 15 additions and 6 deletions

View File

@@ -119,6 +119,7 @@ export async function getNotionPageData({ pageId, from }) {
/**
* 获取用户自定义单页菜单
* 旧版本不读取Menu菜单而是读取type=Page生成菜单
* @param notionPageData
* @returns {Promise<[]|*[]>}
*/
@@ -126,11 +127,16 @@ function getCustomNav({ allPages }) {
const customNav = []
if (allPages && allPages.length > 0) {
allPages.forEach(p => {
p.to = p.slug
if (p?.slug?.indexOf('http') === 0) {
customNav.push({ icon: p.icon || null, name: p.title, to: p.slug, target: '_blank', show: true })
p.target = '_blank'
} else {
customNav.push({ icon: p.icon || null, name: p.title, to: '/' + p.slug, target: '_self', show: true })
p.target = '_self'
if (p?.slug?.indexOf('/') !== 0) {
p.to = '/' + p.slug
}
}
customNav.push({ icon: p.icon || null, name: p.title, to: p.slug, target: '_blank', show: true })
})
}
return customNav
@@ -149,6 +155,12 @@ function getCustomMenu({ collectionData }) {
e.show = true
if (e?.slug?.indexOf('http') === 0) {
e.target = '_blank'
e.to = e.slug
} else {
e.target = '_self'
if (e?.slug?.indexOf('/') !== 0) {
e.to = '/' + e.slug
}
}
if (e.type === BLOG.NOTION_PROPERTY_NAME.type_menu) {
menus.push(e)