2026-07-30 11:23:50 +08:00
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
|
import zhCN from '~~/i18n/locales/zh.json';
|
|
|
|
|
|
import enUS from '~~/i18n/locales/en.json';
|
|
|
|
|
|
|
|
|
|
|
|
const { locale } = useI18n();
|
|
|
|
|
|
|
2026-07-31 19:02:00 +08:00
|
|
|
|
// 应用启动时拉取全局站点配置(导航/页脚/社交/i18n 词条/产品)
|
|
|
|
|
|
const siteStore = useSiteStore();
|
|
|
|
|
|
siteStore.init();
|
|
|
|
|
|
|
2026-07-30 11:23:50 +08:00
|
|
|
|
useHead({
|
|
|
|
|
|
htmlAttrs: {
|
|
|
|
|
|
lang: () => (locale.value === 'zh' ? 'zh-CN' : 'en-US')
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// 根据当前语言动态设置页面标题
|
2026-07-31 19:02:00 +08:00
|
|
|
|
// i18n v10:useLocaleHead 选项为 { lang, dir, seo }(均默认 true)
|
2026-07-30 11:23:50 +08:00
|
|
|
|
const head = useLocaleHead({
|
2026-07-31 19:02:00 +08:00
|
|
|
|
lang: true,
|
|
|
|
|
|
dir: true,
|
|
|
|
|
|
seo: true
|
2026-07-30 11:23:50 +08:00
|
|
|
|
});
|
|
|
|
|
|
|
2026-08-04 19:18:35 +08:00
|
|
|
|
// Favicon(来自 dashboard 站点信息,站点数据异步加载完成后动态注入;/uploads/... 相对路径已由数据层解析)
|
|
|
|
|
|
const faviconHref = computed(() => siteStore.site?.favicon_url || '');
|
|
|
|
|
|
const faviconType = computed(() => {
|
|
|
|
|
|
if (faviconHref.value.endsWith('.svg')) return 'image/svg+xml';
|
|
|
|
|
|
if (faviconHref.value.endsWith('.png')) return 'image/png';
|
|
|
|
|
|
if (faviconHref.value.endsWith('.ico')) return 'image/x-icon';
|
|
|
|
|
|
return '';
|
|
|
|
|
|
});
|
|
|
|
|
|
|
2026-07-30 11:23:50 +08:00
|
|
|
|
useHead({
|
|
|
|
|
|
title: () => (locale.value === 'zh' ? zhCN.app.name : enUS.app.name),
|
|
|
|
|
|
htmlAttrs: head.value.htmlAttrs,
|
2026-08-04 19:18:35 +08:00
|
|
|
|
link: () => [
|
|
|
|
|
|
...(head.value.link || []),
|
|
|
|
|
|
...(faviconHref.value ? [{ rel: 'icon' as const, type: faviconType.value || undefined, href: faviconHref.value }] : [])
|
|
|
|
|
|
],
|
2026-07-30 11:23:50 +08:00
|
|
|
|
meta: [...(head.value.meta || [])]
|
|
|
|
|
|
});
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
|
<NuxtLayout>
|
|
|
|
|
|
<NuxtPage />
|
|
|
|
|
|
</NuxtLayout>
|
|
|
|
|
|
</template>
|