feat(admin): 添加深色主题支持

- 新增主题切换功能,支持浅色、深色和跟随系统三种模式
- 创建主题管理组合式函数 useTheme 和 CSS 变量定义
- 在所有视图组件中应用 CSS 变量以实现主题适配
- 在布局头部添加主题切换按钮,支持循环切换主题
- 更新 .gitignore 添加 .trae 文件忽略
This commit is contained in:
anghunk
2026-01-27 11:07:13 +08:00
parent 61f2223825
commit ba8349b04c
12 changed files with 411 additions and 220 deletions

View File

@@ -4,7 +4,16 @@
</div>
</template>
<script setup lang="ts"></script>
<script setup lang="ts">
import { onMounted } from "vue";
import { useTheme } from "./composables/useTheme";
const { initTheme } = useTheme();
onMounted(() => {
initTheme();
});
</script>
<style>
html,
@@ -17,6 +26,7 @@ body,
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
background-color: #f5f5f5;
background-color: var(--bg-body);
color: var(--text-primary);
}
</style>