56 lines
2.4 KiB
TypeScript
56 lines
2.4 KiB
TypeScript
import { createPinia } from 'pinia'
|
|
import { createApp } from 'vue'
|
|
import ElementPlus from 'element-plus'
|
|
import 'element-plus/dist/index.css'
|
|
// FE-Design-Audit A2:EP 官方暗色全量变量(html.dark 生效)——修复表格斑马/hover/
|
|
// disabled/loading 遮罩/MessageBox 在暗色下的亮色残留;theme-teal 仅保留 teal 微调层。
|
|
import 'element-plus/theme-chalk/dark/css-vars.css'
|
|
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
|
|
import App from './App.vue'
|
|
import router from './router'
|
|
import { setupRouterGuard } from './router/guard'
|
|
import { setupDirectives } from './directives/permission'
|
|
import { installFeErrorReporter, reportFeError } from './utils/error-reporter'
|
|
import './styles/tokens.scss' // W1:设计 token 单一来源(:root=暗,html:not(.dark)=亮)
|
|
import './styles/ep-theme.scss' // W1:EP 官方 CSS 变量全量换肤(零元素补丁;结构桥≤20行见文末)
|
|
import './styles/shell.scss' // W1:布局壳(demo 直译+H1折叠+H2滚动条+语义徽章+基础重置)
|
|
|
|
// G1:暗色偏好启动恢复(demo 默认暗;显式 '0' 才亮)——登录页/刷新后 glass-card
|
|
// 与 aurora 光斑依赖 demo-base 的 :root 暗色变量,html.dark 缺位即 light 变量错配
|
|
if (localStorage.getItem('gosms_dark') !== '0') {
|
|
document.documentElement.classList.add('dark')
|
|
}
|
|
|
|
async function bootstrap() {
|
|
const app = createApp(App)
|
|
// Day 53(runbook §6.4 P0):前端错误上报先于一切挂载——
|
|
// bootstrap 后续阶段的白屏/资源错误也要能送达后端 fe_error_log。
|
|
installFeErrorReporter()
|
|
app.config.errorHandler = (err, _instance, info) => {
|
|
reportFeError({
|
|
kind: 'js',
|
|
page_url: window.location.href,
|
|
message: `VueHandler:${info} ${err instanceof Error ? err.message : String(err)}`.slice(0, 1024),
|
|
stack: err instanceof Error ? err.stack : undefined,
|
|
ua: navigator.userAgent,
|
|
})
|
|
}
|
|
app.use(createPinia())
|
|
app.use(router)
|
|
app.use(ElementPlus)
|
|
// 全局注册图标(MainLayout 菜单按字符串名动态渲染 <component :is>)
|
|
for (const [name, comp] of Object.entries(ElementPlusIconsVue)) {
|
|
app.component(name, comp)
|
|
}
|
|
setupDirectives(app)
|
|
setupRouterGuard(router)
|
|
|
|
// S3·FE-6:浏览器 Mock 通道已下线(单一 real 模式直连网关);msw 仅保留
|
|
// 于 vitest 层(mocks/node.ts,测试隔离服务器)。
|
|
|
|
await router.isReady()
|
|
app.mount('#app')
|
|
}
|
|
|
|
bootstrap()
|