main.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. import Vue from "vue";
  2. import Cookies from "js-cookie";
  3. import Element from "element-ui";
  4. import Utils from "./utils/dateUtils";
  5. import "./assets/styles/element-variables.scss";
  6. import "@/assets/styles/index.scss"; // global css
  7. import "@/assets/styles/ruoyi.scss"; // ruoyi css
  8. import App from "./App";
  9. import store from "./store";
  10. import router from "./router";
  11. import directive from "./directive"; // directive
  12. import plugins from "./plugins"; // plugins
  13. import { download } from "@/utils/request";
  14. import "./assets/icons"; // icon
  15. import "./permission"; // permission control
  16. import { getDicts } from "@/api/system/dict/data";
  17. import { getConfigKey } from "@/api/system/config";
  18. import {
  19. parseTime,
  20. resetForm,
  21. addDateRange,
  22. selectDictLabel,
  23. selectDictLabels,
  24. handleTree,
  25. } from "@/utils/ruoyi";
  26. // 分页组件
  27. import Pagination from "@/components/Pagination";
  28. // 自定义表格工具组件
  29. import RightToolbar from "@/components/RightToolbar";
  30. // 富文本组件
  31. import Editor from "@/components/Editor";
  32. // 文件上传组件
  33. import FileUpload from "@/components/FileUpload";
  34. // 图片上传组件
  35. import ImageUpload from "@/components/ImageUpload";
  36. // 图片预览组件
  37. import ImagePreview from "@/components/ImagePreview";
  38. // 字典标签组件
  39. import DictTag from "@/components/DictTag";
  40. // 头部标签组件
  41. import VueMeta from "vue-meta";
  42. // 字典数据组件
  43. import DictData from "@/components/DictData";
  44. // 全局方法挂载
  45. Vue.prototype.getDicts = getDicts;
  46. Vue.prototype.getConfigKey = getConfigKey;
  47. Vue.prototype.parseTime = parseTime;
  48. Vue.prototype.resetForm = resetForm;
  49. Vue.prototype.addDateRange = addDateRange;
  50. Vue.prototype.selectDictLabel = selectDictLabel;
  51. Vue.prototype.selectDictLabels = selectDictLabels;
  52. Vue.prototype.download = download;
  53. Vue.prototype.handleTree = handleTree;
  54. Vue.prototype.Utils = Utils;
  55. // 全局组件挂载
  56. Vue.component("DictTag", DictTag);
  57. Vue.component("Pagination", Pagination);
  58. Vue.component("RightToolbar", RightToolbar);
  59. Vue.component("Editor", Editor);
  60. Vue.component("FileUpload", FileUpload);
  61. Vue.component("ImageUpload", ImageUpload);
  62. Vue.component("ImagePreview", ImagePreview);
  63. Vue.use(directive);
  64. Vue.use(plugins);
  65. Vue.use(VueMeta);
  66. DictData.install();
  67. /**
  68. * If you don't want to use mock-server
  69. * you want to use MockJs for mock api
  70. * you can execute: mockXHR()
  71. *
  72. * Currently MockJs will be used in the production environment,
  73. * please remove it before going online! ! !
  74. */
  75. Vue.use(Element, {
  76. size: Cookies.get("size") || "medium", // set element-ui default size
  77. });
  78. Vue.config.productionTip = false;
  79. new Vue({
  80. el: "#app",
  81. router,
  82. store,
  83. render: (h) => h(App),
  84. });