🐞 fix: 进一步的检查与校准

This commit is contained in:
IGCrystal
2025-06-17 12:22:00 +08:00
parent 7e4c89b0cb
commit 38eae1d1ee
16 changed files with 75 additions and 48 deletions
@@ -3,12 +3,12 @@
<template v-slot:activator="{ props: activatorProps }">
<v-btn
v-bind="activatorProps"
:variant="props.variant === 'header' ? 'flat' : 'text'"
:color="props.variant === 'header' ? 'var(--v-theme-surface)' : undefined"
:rounded="props.variant === 'header' ? 'sm' : undefined"
:variant="(props.variant === 'header' || props.variant === 'chatbox') ? 'flat' : 'text'"
:color="(props.variant === 'header' || props.variant === 'chatbox') ? 'var(--v-theme-surface)' : undefined"
:rounded="(props.variant === 'header' || props.variant === 'chatbox') ? 'sm' : undefined"
icon
size="small"
:class="['language-switcher', `language-switcher--${props.variant}`, props.variant === 'header' ? 'action-btn' : '']"
:class="['language-switcher', `language-switcher--${props.variant}`, (props.variant === 'header' || props.variant === 'chatbox') ? 'action-btn' : '']"
>
<v-icon
size="18"
@@ -51,7 +51,7 @@ import type { Locale } from '@/i18n/types'
// 定义props来控制样式变体
const props = withDefaults(defineProps<{
variant?: 'default' | 'header'
variant?: 'default' | 'header' | 'chatbox'
}>(), {
variant: 'default'
})
@@ -101,6 +101,11 @@ const changeLanguage = async (langCode: string) => {
/* action-btn类已经处理了margin-right: 6px,不需要额外样式 */
}
/* ChatBox变体样式 - 与Header保持一致 */
.language-switcher--chatbox {
/* 继承action-btn样式,与工具栏主题按钮保持一致 */
}
/* 深色模式下的悬停效果(仅对default变体) */
:deep(.v-theme--PurpleThemeDark) .language-switcher--default:hover {
background: rgba(114, 46, 209, 0.12) !important;
+13 -10
View File
@@ -7,11 +7,11 @@
<div class="logo-text">
<h2
:style="{color: useCustomizerStore().uiTheme === 'PurpleTheme' ? '#5e35b1' : '#d7c5fa'}"
v-html="formatTitle(title)"
v-html="formatTitle(title || t('core.header.logoTitle'))"
></h2>
<!-- 父子组件传递css变量可能会出错暂时使用十六进制颜色值 -->
<h4 :style="{color: useCustomizerStore().uiTheme === 'PurpleTheme' ? '#000000aa' : '#ffffffcc'}"
class="hint-text">{{ subtitle }}</h4>
class="hint-text">{{ subtitle || t('core.header.accountDialog.title') }}</h4>
</div>
</div>
</div>
@@ -19,23 +19,26 @@
<script setup lang="ts">
import { useCustomizerStore } from "@/stores/customizer";
import { useI18n } from '@/i18n/composables';
const { t } = useI18n();
const props = withDefaults(defineProps<{
title?: string;
subtitle?: string;
}>(), {
title: 'AstrBot 仪表盘',
subtitle: '欢迎使用'
title: '', // 默认为空,组件会使用翻译值
subtitle: ''
})
// 格式化标题,在小屏幕上允许在合适位置换行
// 智能格式化标题,在小屏幕上允许在合适位置换行
const formatTitle = (title: string) => {
if (title === 'AstrBot 仪表盘') {
return 'AstrBot<wbr> 仪表盘'
} else if (title === 'AstrBot Dashboard') {
return 'AstrBot<wbr> Dashboard'
// 如果标题包含 "AstrBot" 和其他文字,在它们之间添加换行机会
if (title.includes('AstrBot ') || title.includes('AstrBot')) {
// 处理 "AstrBot 仪表盘" 或 "AstrBot Dashboard" 等格式
return title.replace(/(AstrBot)\s+(.+)/, '$1<wbr> $2');
}
return title
return title;
}
</script>