main.ts 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. import App from "./App.vue";
  2. import router from "./router";
  3. import { setupStore } from "/@/store";
  4. import ElementPlus from "element-plus";
  5. import { getServerConfig } from "./config";
  6. import { createApp, Directive } from "vue";
  7. import { useI18n } from "../src/plugins/i18n";
  8. import { MotionPlugin } from "@vueuse/motion";
  9. import { useEcharts } from "/@/plugins/echarts";
  10. import VirtualScroller from "vue-virtual-scroller";
  11. import { useTable } from "../src/plugins/vxe-table";
  12. import { injectResponsiveStorage } from "/@/utils/responsive";
  13. import Table from "@pureadmin/table";
  14. import PureDescriptions from "@pureadmin/descriptions";
  15. import "uno.css";
  16. import "animate.css";
  17. // 引入重置样式
  18. import "./style/reset.scss";
  19. // 导入公共样式
  20. import "./style/index.scss";
  21. import "element-plus/dist/index.css";
  22. import "@pureadmin/components/dist/index.css";
  23. import "@pureadmin/components/dist/theme.css";
  24. // 导入字体图标
  25. import "./assets/iconfont/iconfont.js";
  26. import "./assets/iconfont/iconfont.css";
  27. import "v-contextmenu/dist/themes/default.css";
  28. import "vue-virtual-scroller/dist/vue-virtual-scroller.css";
  29. const app = createApp(App);
  30. // 自定义指令
  31. import * as directives from "/@/directives";
  32. Object.keys(directives).forEach(key => {
  33. app.directive(key, (directives as { [key: string]: Directive })[key]);
  34. });
  35. // 全局注册`@iconify/vue`图标库
  36. import {
  37. IconifyIconOffline,
  38. IconifyIconOnline,
  39. FontIcon
  40. } from "./components/ReIcon";
  41. app.component("IconifyIconOffline", IconifyIconOffline);
  42. app.component("IconifyIconOnline", IconifyIconOnline);
  43. app.component("FontIcon", FontIcon);
  44. getServerConfig(app).then(async config => {
  45. app.use(router);
  46. await router.isReady();
  47. injectResponsiveStorage(app, config);
  48. setupStore(app);
  49. app
  50. .use(MotionPlugin)
  51. .use(useI18n)
  52. .use(ElementPlus)
  53. .use(Table)
  54. .use(PureDescriptions)
  55. .use(useTable)
  56. .use(useEcharts)
  57. .use(VirtualScroller);
  58. app.mount("#app");
  59. });