| 12345678910111213141516171819202122232425262728293031323334 |
- <template>
- <view class="app-container" :data-theme="themeStore.theme">
- <slot />
- </view>
- </template>
- <script setup>
- import { onLaunch } from '@dcloudio/uni-app'
- import { useUserStore } from '@/stores/user'
- import { useThemeStore } from '@/stores/theme'
- const userStore = useUserStore()
- const themeStore = useThemeStore()
- onLaunch(() => {
- // Initialize theme first (before anything renders)
- themeStore.init()
- // Fetch user profile if logged in
- if (userStore.isLoggedIn) {
- userStore.fetchProfile().catch(() => {})
- }
- })
- </script>
- <style>
- .app-container {
- min-height: 100vh;
- /* Use CSS variables for theme-aware backgrounds */
- background: var(--color-bg);
- color: var(--color-text-primary);
- transition: background var(--transition-normal), color var(--transition-normal);
- }
- </style>
|