1234567891011121314151617181920212223242526272829 |
- <template>
- <el-config-provider :locale="appStore.locale" :size="appStore.size">
- <router-view />
- </el-config-provider>
- </template>
- <script setup lang="ts">
- import { useSettingsStore } from '@/store/modules/settings';
- import { handleThemeStyle } from '@/utils/theme';
- import { useAppStore } from '@/store/modules/app';
- const appStore = useAppStore();
- onMounted(() => {
- nextTick(() => {
- try {
- // 初始化主题样式,添加错误处理
- const settingsStore = useSettingsStore();
- const theme = settingsStore.theme;
- console.log('初始化主题:', theme);
- handleThemeStyle(theme);
- } catch (error) {
- console.warn('主题初始化失败,使用默认主题:', error);
- // 使用默认主题色
- handleThemeStyle('#409EFF');
- }
- });
- });
- </script>
|