29 lines
1.2 KiB
TypeScript
29 lines
1.2 KiB
TypeScript
// ⚠️ 必须放在最前面:vue-router 会注册 visibilitychange 监听器,在页面隐藏时
|
||
// 调用原生 history.replaceState,Edge 会因此把最小化的窗口拉回前台。
|
||
// 本文件把那个原生调用拦掉。详见 utils/history-guard.ts 的注释。
|
||
import './utils/history-guard'
|
||
|
||
import { createApp } from 'vue'
|
||
import { createPinia } from 'pinia'
|
||
// 按需样式:程序化导入的组件需要单独补 CSS(模板里的会自动 tree-shake)
|
||
import 'element-plus/theme-chalk/el-message.css'
|
||
import 'element-plus/theme-chalk/el-message-box.css'
|
||
// Element Plus 暗色模式两步之一:引入暗色 CSS 变量(之二是给 <html> 加 dark 类,
|
||
// 由 stores/theme.ts 的 applyTheme() 在 mount 之前完成,避免主题闪烁)
|
||
import 'element-plus/theme-chalk/dark/css-vars.css'
|
||
import App from './App.vue'
|
||
import router from './router'
|
||
import './styles/index.scss'
|
||
import { useThemeStore } from './stores/theme'
|
||
|
||
const app = createApp(App)
|
||
const pinia = createPinia()
|
||
|
||
app.use(pinia)
|
||
app.use(router)
|
||
|
||
// 显式传 pinia:initTheme 在组件树之外执行,不依赖“已激活的 pinia”
|
||
useThemeStore(pinia).initTheme()
|
||
|
||
app.mount('#app')
|