main.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import "./assets/main.css";
  2. import ArcoVue from "@arco-design/web-vue";
  3. import ArcoVueIcon from "@arco-design/web-vue/es/icon";
  4. import "@arco-themes/vue-niuniu/css/arco.css";
  5. import { createApp } from "vue";
  6. import App from "./App.vue";
  7. import router from "./router";
  8. import helper from "./utils/helper";
  9. import config from "./utils/config";
  10. import store from './store';
  11. import i18n from './locale';
  12. import ajax from "./ajax";
  13. import outside from "@venegrad/vue3-click-outside";
  14. import '@/assets/style/global.less';
  15. const app = createApp(App);
  16. app.use(ArcoVueIcon);
  17. app.use(router);
  18. app.use(ArcoVue);
  19. app.use(store);
  20. app.use(i18n);
  21. app.provide("$global", {
  22. ajax,
  23. helper,
  24. config
  25. });
  26. app.directive("outside", outside);
  27. app.mount("#app");
  28. helper.getToken();
  29. document.querySelector("#app").$helper = helper;
  30. // 添加全局方法
  31. app.config.globalProperties.$messageSuccess = function (data) {
  32. this.$message.success(data)
  33. };
  34. app.config.globalProperties.$messageWarning = function (data) {
  35. this.$message.warning(data)
  36. };
  37. app.config.globalProperties.$messageError = function (data) {
  38. this.$message.error(data)
  39. };
  40. app.config.globalProperties.$messageInfo = function (data) {
  41. this.$message.info(data)
  42. };
  43. app.config.globalProperties.$messageNormal = function (data) {
  44. this.$message.normal(data)
  45. };