- 新增 styles/theme.css:CSS 变量覆盖默认主题(主色 #4F46E5、圆角、阴影、页面背景),html.dark 暗色变量 - 新增 stores/theme.ts:暗色/亮色切换,localStorage 持久化 - main.ts 引入 element-plus 暗色 css-vars 与主题文件,挂载前初始化主题 - index.html 加 SVG favicon 与防暗色闪烁内联脚本 - AdminLayout:深色可折叠侧栏、header 面包屑 + 暗色切换按钮、页面切换过渡 - UserLayout:header 打磨 + 暗色切换按钮 - LoginView/ApplyView:统一品牌渐变背景与卡片,登录页 OTP 输入行内联发送按钮、登录按钮唯一通栏主按钮(修复按钮错位)
28 lines
807 B
TypeScript
28 lines
807 B
TypeScript
import { createApp } from 'vue'
|
|
import { createPinia } from 'pinia'
|
|
import ElementPlus from 'element-plus'
|
|
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
|
|
import zhCn from 'element-plus/es/locale/lang/zh-cn'
|
|
import 'element-plus/dist/index.css'
|
|
import 'element-plus/theme-chalk/dark/css-vars.css'
|
|
import '@/styles/theme.css'
|
|
|
|
import App from './App.vue'
|
|
import router from './router'
|
|
import { useThemeStore } from '@/stores/theme'
|
|
|
|
const app = createApp(App)
|
|
app.use(createPinia())
|
|
app.use(router)
|
|
app.use(ElementPlus, { locale: zhCn })
|
|
|
|
// 应用主题(暗色/亮色)需在挂载前生效,避免闪烁
|
|
useThemeStore().init()
|
|
|
|
// 全局注册 Element Plus 图标
|
|
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
|
|
app.component(key, component)
|
|
}
|
|
|
|
app.mount('#app')
|