Files
admin/www/app/app.vue
T
2026-07-31 19:02:00 +08:00

38 lines
854 B
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<script setup lang="ts">
import zhCN from '~~/i18n/locales/zh.json';
import enUS from '~~/i18n/locales/en.json';
const { locale } = useI18n();
// 应用启动时拉取全局站点配置(导航/页脚/社交/i18n 词条/产品)
const siteStore = useSiteStore();
siteStore.init();
useHead({
htmlAttrs: {
lang: () => (locale.value === 'zh' ? 'zh-CN' : 'en-US')
}
});
// 根据当前语言动态设置页面标题
// i18n v10useLocaleHead 选项为 { lang, dir, seo }(均默认 true
const head = useLocaleHead({
lang: true,
dir: true,
seo: true
});
useHead({
title: () => (locale.value === 'zh' ? zhCN.app.name : enUS.app.name),
htmlAttrs: head.value.htmlAttrs,
link: [...(head.value.link || [])],
meta: [...(head.value.meta || [])]
});
</script>
<template>
<NuxtLayout>
<NuxtPage />
</NuxtLayout>
</template>