main.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import Vue from 'vue'
  2. import App from './App'
  3. import router from './router'
  4. import ElementUI from 'element-ui';
  5. import './assets/style/im.scss';
  6. import './assets/iconfont/iconfont.css';
  7. import { createPinia, PiniaVuePlugin } from 'pinia'
  8. import httpRequest from './api/httpRequest';
  9. import * as socketApi from './api/wssocket';
  10. import * as messageType from './api/messageType';
  11. import emotion from './api/emotion.js';
  12. import url from './api/url.js';
  13. import str from './api/str.js';
  14. import element from './api/element.js';
  15. import * as enums from './api/enums.js';
  16. import * as date from './api/date.js';
  17. import './utils/directive/dialogDrag';
  18. import useChatStore from './store/chatStore.js'
  19. import useFriendStore from './store/friendStore.js'
  20. import useGroupStore from './store/groupStore.js'
  21. import useUserStore from './store/userStore.js'
  22. import useConfigStore from './store/configStore.js'
  23. Vue.use(PiniaVuePlugin)
  24. const pinia = createPinia()
  25. Vue.use(ElementUI);
  26. // 挂载全局
  27. Vue.prototype.$wsApi = socketApi;
  28. Vue.prototype.$msgType = messageType
  29. Vue.prototype.$date = date;
  30. Vue.prototype.$http = httpRequest // http请求方法
  31. Vue.prototype.$emo = emotion; // emo表情
  32. Vue.prototype.$url = url; // url转换
  33. Vue.prototype.$str = str; // 字符串相关
  34. Vue.prototype.$elm = element; // 元素操作
  35. Vue.prototype.$enums = enums; // 枚举
  36. Vue.prototype.$eventBus = new Vue(); // 全局事件
  37. Vue.config.productionTip = false;
  38. new Vue({
  39. el: '#app',
  40. // 配置路由
  41. router,
  42. pinia,
  43. render: h => h(App)
  44. })
  45. // 挂载全局的pinia
  46. Vue.prototype.chatStore = useChatStore();
  47. Vue.prototype.friendStore = useFriendStore();
  48. Vue.prototype.groupStore = useGroupStore();
  49. Vue.prototype.userStore = useUserStore();
  50. Vue.prototype.configStore = useConfigStore();