main.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. import { createApp } from "vue";
  2. import Cookies from "js-cookie";
  3. import ElementPlus from "element-plus";
  4. import "element-plus/dist/index.css";
  5. import locale from "element-plus/es/locale/lang/zh-cn";
  6. import "@/assets/styles/index.scss"; // global css
  7. import App from "./App";
  8. import store from "./store";
  9. import router from "./router";
  10. import directive from "./directive"; // directive
  11. // 注册指令
  12. import plugins from "./plugins"; // plugins
  13. import { download } from "@/utils/request";
  14. // svg图标
  15. import "virtual:svg-icons-register";
  16. import SvgIcon from "@/components/SvgIcon";
  17. import elementIcons from "@/components/SvgIcon/svgicon";
  18. import "./permission"; // permission control
  19. import { useDict } from "@/utils/dict";
  20. import {
  21. parseTime,
  22. resetForm,
  23. addDateRange,
  24. handleTree,
  25. selectDictLabel,
  26. selectDictLabels,
  27. } from "@/utils/ruoyi";
  28. // 分页组件
  29. import Pagination from "@/components/Pagination";
  30. // 自定义表格工具组件
  31. import RightToolbar from "@/components/RightToolbar";
  32. // 富文本组件
  33. import Editor from "@/components/Editor";
  34. // 文件上传组件
  35. import FileUpload from "@/components/FileUpload";
  36. // 图片上传组件
  37. import ImageUpload from "@/components/ImageUpload";
  38. // 图片预览组件
  39. import ImagePreview from "@/components/ImagePreview";
  40. // 自定义树选择组件
  41. import TreeSelect from "@/components/TreeSelect";
  42. // 字典标签组件
  43. import DictTag from "@/components/DictTag";
  44. import * as echarts from 'echarts';
  45. const app = createApp(App);
  46. // 全局方法挂载
  47. app.config.globalProperties.$echarts = echarts
  48. app.config.globalProperties.useDict = useDict;
  49. app.config.globalProperties.download = download;
  50. app.config.globalProperties.parseTime = parseTime;
  51. app.config.globalProperties.resetForm = resetForm;
  52. app.config.globalProperties.handleTree = handleTree;
  53. app.config.globalProperties.addDateRange = addDateRange;
  54. app.config.globalProperties.selectDictLabel = selectDictLabel;
  55. app.config.globalProperties.selectDictLabels = selectDictLabels;
  56. // 全局组件挂载
  57. app.component("DictTag", DictTag);
  58. app.component("Pagination", Pagination);
  59. app.component("TreeSelect", TreeSelect);
  60. app.component("FileUpload", FileUpload);
  61. app.component("ImageUpload", ImageUpload);
  62. app.component("ImagePreview", ImagePreview);
  63. app.component("RightToolbar", RightToolbar);
  64. app.component("Editor", Editor);
  65. app.use(router);
  66. app.use(store);
  67. app.use(plugins);
  68. app.use(elementIcons);
  69. app.component("svg-icon", SvgIcon);
  70. directive(app);
  71. // 使用element-plus 并且设置全局的大小
  72. app.use(ElementPlus, {
  73. locale: locale,
  74. // 支持 large、default、small
  75. size: Cookies.get("size") || "default",
  76. });
  77. app.mount("#app");