Browse Source

feat: add customLink to navigation hook with filtering logic

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
master
fengsilin 3 weeks ago
parent
commit
49c6755622
1 changed files with 10 additions and 0 deletions
  1. +10
    -0
      web/src/hooks/common/useNavigation.js

+ 10
- 0
web/src/hooks/common/useNavigation.js View File

@@ -47,6 +47,13 @@ export const useNavigation = (t, headerNavModules) => {
itemKey: 'pricing',
to: '/pricing',
},
{
text: modules.customLink?.text || '',
itemKey: 'customLink',
to: modules.customLink?.url || '#',
isExternal: modules.customLink?.url?.startsWith('http'),
externalLink: modules.customLink?.url || '#',
},
];

// 根据配置过滤导航链接
@@ -57,6 +64,9 @@ export const useNavigation = (t, headerNavModules) => {
? modules.pricing.enabled
: modules.pricing;
}
if (link.itemKey === 'customLink') {
return modules.customLink?.enabled === true && modules.customLink?.text;
}
return modules[link.itemKey] === true;
});
}, [t, headerNavModules]);


Loading…
Cancel
Save