🐛 Fixed theme and packaging issues
This commit is contained in:
@@ -3,11 +3,13 @@ import { onMounted } from 'vue';
|
||||
import { useConfigStore } from '@/stores/configStore';
|
||||
import { useSystemStore } from '@/stores/systemStore';
|
||||
import { useKeybindingStore } from '@/stores/keybindingStore';
|
||||
import { useThemeStore } from '@/stores/themeStore';
|
||||
import WindowTitleBar from '@/components/titlebar/WindowTitleBar.vue';
|
||||
|
||||
const configStore = useConfigStore();
|
||||
const systemStore = useSystemStore();
|
||||
const keybindingStore = useKeybindingStore();
|
||||
const themeStore = useThemeStore();
|
||||
|
||||
// 应用启动时加载配置和初始化系统信息
|
||||
onMounted(async () => {
|
||||
@@ -18,7 +20,9 @@ onMounted(async () => {
|
||||
keybindingStore.loadKeyBindings(),
|
||||
]);
|
||||
|
||||
// 初始化语言和主题
|
||||
await configStore.initializeLanguage();
|
||||
themeStore.initializeTheme();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@@ -141,7 +141,7 @@ const DEFAULT_CONFIG: AppConfig = {
|
||||
},
|
||||
appearance: {
|
||||
language: LanguageType.LangZhCN,
|
||||
systemTheme: SystemThemeType.SystemThemeDark
|
||||
systemTheme: SystemThemeType.SystemThemeAuto
|
||||
},
|
||||
updates: {},
|
||||
metadata: {
|
||||
|
@@ -130,7 +130,7 @@ export const useEditorStore = defineStore('editor', () => {
|
||||
|
||||
// 获取主题扩展
|
||||
const themeExtension = createThemeExtension(
|
||||
configStore.config.appearance.systemTheme || SystemThemeType.SystemThemeDark
|
||||
configStore.config.appearance.systemTheme || SystemThemeType.SystemThemeAuto
|
||||
);
|
||||
|
||||
// 获取Tab相关扩展
|
||||
|
@@ -23,6 +23,12 @@ export const useThemeStore = defineStore('theme', () => {
|
||||
);
|
||||
};
|
||||
|
||||
// 初始化主题
|
||||
const initializeTheme = () => {
|
||||
const theme = configStore.config?.appearance?.systemTheme || SystemThemeType.SystemThemeAuto;
|
||||
applyThemeToDOM(theme);
|
||||
};
|
||||
|
||||
// 设置主题
|
||||
const setTheme = async (theme: SystemThemeType) => {
|
||||
await configStore.setSystemTheme(theme);
|
||||
@@ -32,5 +38,7 @@ export const useThemeStore = defineStore('theme', () => {
|
||||
return {
|
||||
currentTheme,
|
||||
setTheme,
|
||||
initializeTheme,
|
||||
applyThemeToDOM,
|
||||
};
|
||||
});
|
Reference in New Issue
Block a user