main.ts 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import { createApp } from 'vue';
  2. import ArcoVue from '@arco-design/web-vue';
  3. import ArcoVueIcon from '@arco-design/web-vue/es/icon';
  4. import globalComponents from '@/components';
  5. import router from './router';
  6. import store from './store';
  7. import i18n from './locale';
  8. import directive from './directive';
  9. import './mock';
  10. import App from './App.vue';
  11. // Styles are imported via arco-plugin. See config/plugin/arcoStyleImport.ts in the directory for details
  12. // 样式通过 arco-plugin 插件导入。详见目录文件 config/plugin/arcoStyleImport.ts
  13. // https://arco.design/docs/designlab/use-theme-package
  14. import '@/assets/style/global.less';
  15. import '@/api/interceptor';
  16. const app = createApp(App);
  17. app.use(ArcoVue, {});
  18. app.use(ArcoVueIcon);
  19. app.use(router);
  20. app.use(store);
  21. app.use(i18n);
  22. app.use(globalComponents);
  23. app.use(directive);
  24. app.mount('#app');
  25. // 添加全局方法
  26. app.config.globalProperties.$messageSuccess = function (data) {
  27. this.$message.success(data)
  28. };
  29. app.config.globalProperties.$messageWarning = function (data) {
  30. this.$message.warning(data)
  31. };
  32. app.config.globalProperties.$messageError = function (data) {
  33. this.$message.error(data)
  34. };
  35. app.config.globalProperties.$messageInfo = function (data) {
  36. this.$message.info(data)
  37. };
  38. app.config.globalProperties.$messageNormal = function (data) {
  39. this.$message.normal(data)
  40. };