feat: 完成布局/仪表板/用户相关组件国际化与语言切换优化(TabBar/MainLayout/AppHeader、UsageTrend/ModelDistribution、User*、Common 组件、i18n/locale 增强)

This commit is contained in:
Wangnov
2025-09-10 18:13:27 +08:00
parent 022724336b
commit d5b9f809b0
20 changed files with 410 additions and 300 deletions

View File

@@ -12,8 +12,8 @@
<i :class="getIconClass(toast.type)" />
</div>
<div class="toast-body">
<div v-if="toast.title" class="toast-title">
{{ toast.title }}
<div v-if="toast.title || getDefaultTitle(toast.type)" class="toast-title">
{{ toast.title || getDefaultTitle(toast.type) }}
</div>
<div class="toast-message">
{{ toast.message }}
@@ -35,6 +35,9 @@
<script setup>
import { ref, onMounted, onUnmounted } from 'vue'
import { useI18n } from 'vue-i18n'
const { t } = useI18n()
// 状态
const toasts = ref([])
@@ -51,6 +54,11 @@ const getIconClass = (type) => {
return iconMap[type] || iconMap.info
}
// 获取默认标题
const getDefaultTitle = (type) => {
return t(`common.toastNotification.defaultTitles.${type}`)
}
// 添加Toast
const addToast = (message, type = 'info', title = null, duration = 5000) => {
const id = ++toastIdCounter