main.js 3.1 KB

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