feat: 优化windows下右上角控制栏样式

This commit is contained in:
digua
2026-02-15 11:16:03 +08:00
parent 89b479e292
commit e198aedc67
5 changed files with 38 additions and 5 deletions
+8
View File
@@ -30,6 +30,14 @@ const tooltip = {
// 应用启动时初始化
onMounted(async () => {
// 平台检测 - 设置 CSS 类名以驱动平台差异化样式(如标题栏安全区域高度)
const platform = navigator.platform.toLowerCase()
if (platform.includes('win')) {
document.documentElement.classList.add('platform-windows')
} else if (platform.includes('linux')) {
document.documentElement.classList.add('platform-linux')
}
// 初始化语言设置(同步 i18n 和 dayjs
settingsStore.initLocale()
// 初始化 LLM 配置(预加载,避免首次使用时延迟)
+12
View File
@@ -51,6 +51,18 @@
background-color: var(--color-gray-600);
}
/* 标题栏安全区域高度 - 页面顶部 padding 需要避开此区域
* macOS: 红绿灯在左侧由 Sidebar 处理,右侧内容区无遮挡,使用较小值
* Windows/Linux: 窗口控制按钮在右上角占据 32px 高度,需要完整避开 */
:root {
--titlebar-area-height: 1rem; /* 16px - macOS */
}
.platform-windows,
.platform-linux {
--titlebar-area-height: 2rem; /* 32px - 匹配 titleBarOverlay height */
}
/* 禁用窗口拖拽区域 - 用于弹窗等需要正常交互的元素 */
.app-region-no-drag {
-webkit-app-region: no-drag;
+16 -3
View File
@@ -15,9 +15,9 @@ defineProps<{
<template>
<div class="relative border-b border-gray-200/50 px-6 pb-2 dark:border-gray-800/50">
<!-- 拖拽区域 - 覆盖顶部区域 (包含上方 padding 16px + 头部内部 16px) -->
<!-- 这样既保证了顶部可以拖拽又不会遮挡 Header 内部的按钮和交互元素 -->
<div class="absolute -top-4 left-0 right-0 h-8 z-50" style="-webkit-app-region: drag" />
<!-- 拖拽区域 - 覆盖顶部安全区域平台自适应
macOS: 16px padding + 16px = 32px | Windows/Linux: 32px padding + 16px = 48px -->
<div class="titlebar-drag-cover" />
<!-- 标题区域 -->
<div class="flex items-center justify-between">
@@ -51,3 +51,16 @@ defineProps<{
<slot />
</div>
</template>
<style scoped>
/* 标题栏拖拽覆盖区域 - 使用 CSS 变量实现平台自适应高度 */
.titlebar-drag-cover {
position: absolute;
left: 0;
right: 0;
z-index: 50;
top: calc(-1 * var(--titlebar-area-height));
height: calc(var(--titlebar-area-height) + 1rem);
-webkit-app-region: drag;
}
</style>
+1 -1
View File
@@ -186,7 +186,7 @@ onMounted(() => {
</script>
<template>
<div class="flex h-full flex-col bg-white pt-4 dark:bg-gray-900">
<div class="flex h-full flex-col bg-white dark:bg-gray-900" style="padding-top: var(--titlebar-area-height)">
<!-- Loading State -->
<LoadingState v-if="isInitialLoad" variant="page" :text="t('analysis.groupChat.loading')" />
+1 -1
View File
@@ -195,7 +195,7 @@ onMounted(() => {
</script>
<template>
<div class="flex h-full flex-col bg-white pt-4 dark:bg-gray-900">
<div class="flex h-full flex-col bg-white dark:bg-gray-900" style="padding-top: var(--titlebar-area-height)">
<!-- Loading State -->
<LoadingState v-if="isInitialLoad" variant="page" :text="t('analysis.privateChat.loading')" />