main.ts 1.0 KB

12345678910111213141516171819202122232425262728293031
  1. import 'core-js'
  2. import 'regenerator-runtime/runtime'
  3. import { createApp } from 'vue'
  4. import App from './App.vue'
  5. import router from './router'
  6. import directives from '@/directives' // 自定义指令集
  7. //import 'default-passive-events'
  8. import '@/utils/h5plus' // 加载html5+
  9. import 'hqchart/src/jscommon/umychart.resource/font/iconfont.css'
  10. import layouts from './components/layouts' // 全局布局组件
  11. import 'vant/lib/index.css'
  12. import './assets/themes/style.less' // 主题样式
  13. import { timerInterceptor } from '@/utils/timer'
  14. import { useGlobalStore } from '@/stores'
  15. // import Vconsole from 'vconsole'
  16. // new Vconsole()
  17. const app = createApp(App)
  18. app.use(router)
  19. app.use(directives)
  20. app.use(layouts)
  21. app.mount('#app')
  22. // 等待 html 加载完成
  23. document.addEventListener('DOMContentLoaded', () => {
  24. const { screenAdapter } = useGlobalStore()
  25. // 适配客户端
  26. screenAdapter(true)
  27. // 监听窗口大小变化
  28. window.addEventListener('resize', timerInterceptor.setDebounce(() => screenAdapter(true)))
  29. }, false)