mateclaw/mateclaw-ui/src/App.vue

26 lines
675 B
Vue

<template>
<el-config-provider :locale="elementLocale">
<router-view />
</el-config-provider>
</template>
<script setup lang="ts">
import { computed, watchEffect } from 'vue'
import { useI18n } from 'vue-i18n'
import en from 'element-plus/es/locale/lang/en'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import { currentLocale } from '@/i18n'
import { useThemeStore } from '@/stores/useThemeStore'
// Initialize theme — applies .dark class to <html> immediately
useThemeStore()
const { t } = useI18n()
watchEffect(() => {
document.title = t('app.title')
})
const elementLocale = computed(() => (currentLocale.value === 'en-US' ? en : zhCn))
</script>