main.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. import {
  2. createApp
  3. } from "vue";
  4. import App from "./App.vue";
  5. import router from "./router";
  6. import i18n from "@/lang/";
  7. import {
  8. moneyFormat,
  9. getDictOne,
  10. compareTime,
  11. dictValueLabel,
  12. dictKeyValue,
  13. formChange,
  14. formChangeTwo,
  15. deepClone,
  16. getFile,
  17. onPreviewFile
  18. } from "@/utils/util";
  19. import {
  20. handleTree
  21. } from "@/utils/ruoyi";
  22. // 全局文件上传地址
  23. let prefix =
  24. window.location.protocol.indexOf("https") >= 0 ? "https://" : "http://";
  25. const uploadUrl =
  26. prefix +
  27. process.env.VUE_APP_UPLOAD_API +
  28. process.env.VUE_APP_UPLOAD_BASE_API + '/open/fileInfo/upload'
  29. const app = createApp(App);
  30. app.use(router);
  31. app.use(i18n).mount("#app");
  32. import {
  33. uploadDdRightBtn
  34. } from "@/utils/ddAdapter";
  35. import {
  36. post,
  37. get
  38. } from "@/utils/axios";
  39. import store from './store'
  40. app.config.globalProperties.get = get;
  41. app.config.globalProperties.post = post;
  42. // 金额千分符
  43. app.config.globalProperties.moneyFormat = moneyFormat;
  44. // 获取字典
  45. app.config.globalProperties.getDictOne = getDictOne;
  46. // 字典回显
  47. app.config.globalProperties.dictValueLabel = dictValueLabel;
  48. app.config.globalProperties.dictKeyValue = dictKeyValue;
  49. // 比较时间大小
  50. app.config.globalProperties.compareTime = compareTime;
  51. app.config.globalProperties.uploadDdRightBtn = uploadDdRightBtn;
  52. // form组件 select change事件回填
  53. app.config.globalProperties.formChange = formChange;
  54. app.config.globalProperties.formChangeTwo = formChangeTwo;
  55. // 深拷贝
  56. app.config.globalProperties.deepClone = deepClone;
  57. app.config.globalProperties.handleTree = handleTree;
  58. app.config.globalProperties.getFile = getFile;
  59. app.config.globalProperties.onPreviewFile = onPreviewFile;
  60. app.config.globalProperties.uploadUrl = uploadUrl;
  61. //pinia
  62. app.use(store);
  63. //中英文全局挂载
  64. app.config.globalProperties.t = i18n.global.t;
  65. export default app;