官网开发中 0731

This commit is contained in:
eafonyang
2026-07-31 19:02:00 +08:00
parent fda4fa8627
commit eeccdb079c
36 changed files with 1944 additions and 105 deletions
+20
View File
@@ -0,0 +1,20 @@
/**
* 链接解析:区分外部 URL 与站内路由
*
* 站内路由自动加当前语言前缀(中文无前缀,英文 /en 前缀)。
*/
export function useLinkResolver() {
const localePath = useLocalePath();
function isExternal(link: string): boolean {
return /^https?:\/\//.test(link);
}
function resolveLink(link: string): string {
if (!link) return '';
if (isExternal(link)) return link;
return localePath(link);
}
return { isExternal, resolveLink };
}