| | |
| | | import { createApp } from 'vue' |
| | | import './assets/css/index.scss' |
| | | import './assets/css/init.scss' |
| | | import './assets/theme/index.scss' |
| | | import 'vant/lib/index.css' |
| | | import fxHeader from '@/components/fx-header' |
| | | import 'default-passive-events' |
| | |
| | | import pinia from '@/store' |
| | | import store from '@/store/store' |
| | | import piniaPluginPersistedstate from 'pinia-plugin-persistedstate' |
| | | import { getStorage } from '@/utils/utis' |
| | | pinia.use(piniaPluginPersistedstate) |
| | | |
| | | // 初始化主题为黑夜模式 |
| | | const theme = getStorage('theme') || 'dark' |
| | | window.document.documentElement.setAttribute('data-theme', theme) |
| | | |
| | | const app = createApp(App) |
| | | const title = import.meta.env.VITE_APP__TITLE |
| | |
| | | app.use(pinia) |
| | | app.use(store) |
| | | |
| | | // 确保store中的主题状态与DOM同步 |
| | | app.mount('#app') |
| | | // 在应用挂载后初始化主题 |
| | | if (store.state.vant && store.state.vant.theme !== theme) { |
| | | store.commit('vant/SET_THEME', theme) |
| | | } else if (!store.state.vant || !store.state.vant.theme) { |
| | | store.commit('vant/SET_THEME', theme) |
| | | } |