components.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import config from "./config";
  2. // import api from './api'
  3. import tool from "./utils/tool";
  4. import ImageSelect from "./components/upload/ImageSelect.vue";
  5. import ImageUpload from "./components/upload/ImageUpload.vue";
  6. import FileUpload from "./components/upload/FileUpload.vue";
  7. import vueDialog from "./components/vueDialog/index.vue";
  8. import time from "./directives/time";
  9. import copy from "./directives/copy";
  10. import noMoreClick from "./directives/noMoreClick";
  11. // import errorHandler from './utils/errorHandler'
  12. // import * as elIcons from '@element-plus/icons-vue'
  13. import { QuillEditor } from "@vueup/vue-quill";
  14. import "@vueup/vue-quill/dist/vue-quill.snow.css";
  15. import * as jpIcons from "./assets/icons";
  16. import * as icons from "@element-plus/icons-vue";
  17. import VCharts from "./components/vueEcharts/index.vue";
  18. export default {
  19. install(app) {
  20. //挂载全局对象
  21. app.config.globalProperties.$CONFIG = config;
  22. app.config.globalProperties.$TOOL = tool;
  23. //注册全局组件
  24. app.component("QuillEditor", QuillEditor);
  25. app.component("ImageSelect", ImageSelect);
  26. app.component("ImageUpload", ImageUpload);
  27. app.component("FileUpload", FileUpload);
  28. app.component("v-dialog", vueDialog);
  29. app.component("v-chart", VCharts);
  30. //注册全局指令
  31. app.directive("time", time);
  32. app.directive("copy", copy);
  33. app.directive("noMoreClick", noMoreClick);
  34. //统一注册el-icon图标
  35. for (let icon in icons) {
  36. app.component(`ElIcon${icon}`, icons[icon]);
  37. }
  38. Object.keys(icons).forEach((key) => {
  39. app.component(`${key}`, icons[key]);
  40. });
  41. //统一注册sc-icon图标
  42. for (let icon in jpIcons) {
  43. app.component(`${icon}`, jpIcons[icon]);
  44. }
  45. //全局代码错误捕捉
  46. // app.config.errorHandler = errorHandler
  47. },
  48. };