main.ts 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import { createApp } from 'vue';
  2. // global css
  3. import 'uno.css';
  4. import '@/assets/styles/index.scss';
  5. import 'element-plus/theme-chalk/dark/css-vars.css';
  6. // App、router、store
  7. import App from './App.vue';
  8. import store from './store';
  9. import router from './router';
  10. // 自定义指令
  11. import directive from './directive';
  12. // 注册插件
  13. import plugins from './plugins/index'; // plugins
  14. import { download } from '@/utils/request';
  15. // 预设动画
  16. import animate from './animate';
  17. // svg图标
  18. import 'virtual:svg-icons-register';
  19. import ElementIcons from '@/plugins/svgicon';
  20. // permission control
  21. import './permission';
  22. import { useDict } from '@/utils/dict';
  23. import { getConfigKey, updateConfigByKey } from '@/api/system/config';
  24. import { parseTime, addDateRange, handleTree, selectDictLabel, selectDictLabels } from '@/utils/ruoyi';
  25. // 国际化
  26. import i18n from '@/lang/index';
  27. const app = createApp(App);
  28. // 全局方法挂载
  29. app.config.globalProperties.useDict = useDict;
  30. app.config.globalProperties.getConfigKey = getConfigKey;
  31. app.config.globalProperties.updateConfigByKey = updateConfigByKey;
  32. app.config.globalProperties.download = download;
  33. app.config.globalProperties.parseTime = parseTime;
  34. app.config.globalProperties.handleTree = handleTree;
  35. app.config.globalProperties.addDateRange = addDateRange;
  36. app.config.globalProperties.selectDictLabel = selectDictLabel;
  37. app.config.globalProperties.selectDictLabels = selectDictLabels;
  38. app.config.globalProperties.animate = animate;
  39. app.use(ElementIcons);
  40. app.use(router);
  41. app.use(store);
  42. app.use(i18n);
  43. app.use(plugins);
  44. // 自定义指令
  45. directive(app);
  46. app.mount('#app');