You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

main.ts 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import 'babel-polyfill';
  2. //#pragma warning(disable:18)
  3. import { createApp, createVNode } from 'vue'
  4. import App from './App.vue'
  5. import router from './router/index' //路由
  6. //element-plus 组件相关
  7. import ElementPlus from 'element-plus'
  8. import 'element-plus/dist/index.css'
  9. import zhCn from 'element-plus/es/locale/lang/zh-cn'
  10. import * as EleIcons from '@element-plus/icons-vue'
  11. //fragment
  12. import Fragment from 'vue-fragment'
  13. //全局样式
  14. import './style/main.css'
  15. import { isValidKey } from '@/utils/utils'
  16. //请求
  17. import * as request from '@/api/index'
  18. //导出表格
  19. //import JsonExcel from 'vue-json-excel'
  20. import itemIoc from '@/layout/components/ItemIcon.vue'
  21. const app = createApp(App)
  22. //app.component('downloadExcel', JsonExcel)
  23. //全局注册请求
  24. app.config.globalProperties.$request = request;
  25. app.use(router)
  26. .use(Fragment.Plugin)
  27. .use(ElementPlus, { // 使用element-plus
  28. locale: zhCn,
  29. })
  30. //全局图标组件
  31. for (const name in EleIcons) {
  32. if (isValidKey(name, EleIcons)) {
  33. app.component(name, EleIcons[name]) //添加图标组件
  34. }
  35. }
  36. // 下面为全局注册图标组件
  37. // 创建Icon组件
  38. const Icon: any = (props: { icon: string }) => {
  39. const { icon } = props
  40. return createVNode(EleIcons[icon as keyof typeof EleIcons])
  41. }
  42. // 注册Icon组件
  43. app.component('icon-tab', Icon)
  44. app.component('item-ioc', itemIoc)
  45. app.mount('#app')