| 123456789101112131415161718192021222324252627282930313233 |
- import { createApp } from 'vue'
- import App from './App.vue'
- import router from './router'
- import directives from '@/directives' // 自定义指令集
- import '@/services/subscribe' // 全局订阅通知
- import '@/mock' // 模拟数据
- import layouts from "./components/layouts" // 布局组件
- import ElementPlus from 'element-plus'
- import * as ElementIcons from '@element-plus/icons-vue'
- import 'element-plus/dist/index.css'
- import './assets/themes/style.less' // 主题样式
- import { timerInterceptor } from '@/utils/timer'
- import { themeStore } from '@/stores'
- const app = createApp(App)
- app.use(router)
- app.use(directives)
- app.use(ElementPlus)
- app.use(layouts)
- app.mount('#app')
- // 等待 html 加载完成
- document.addEventListener('DOMContentLoaded', () => {
- // 适配客户端
- themeStore.actions.screenAdapter()
- // 监听窗口大小变化
- window.addEventListener('resize', timerInterceptor.setDebounce(() => themeStore.actions.screenAdapter()))
- }, false)
- // 注册全局图标
- for (const [key, value] of Object.entries(ElementIcons)) {
- app.component(key, value)
- }
|