main.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. import Vue from 'vue';
  2. import 'normalize.css/normalize.css'; // A modern alternative to CSS resets
  3. import ElementUI from 'element-ui';
  4. import 'element-ui/lib/theme-chalk/index.css';
  5. import locale from 'element-ui/lib/locale/lang/en'; // lang i18n
  6. import '@/styles/index.scss'; // global css
  7. import App from './App';
  8. import store from './store';
  9. import router from './router';
  10. import '@/icons'; // icon
  11. import '@/permission'; // permission control
  12. import './components';
  13. import './containers';
  14. import 'utils/dialog-helper';
  15. import '@/plugins/viewerjs';
  16. import message from '@/utils/message';
  17. import bus from './utils/bus';
  18. Vue.prototype.$Bus = bus;
  19. Vue.prototype.$g_emit = (eventName, payload) => {
  20. bus.$emit(eventName, payload);
  21. };
  22. Vue.prototype.$g_on = (eventName, func) => {
  23. bus.$on(eventName, func);
  24. };
  25. Vue.prototype.$g_off = (eventName, func) => {
  26. bus.$off(eventName, func);
  27. };
  28. /**
  29. * If you don't want to use mock-server
  30. * you want to use MockJs for mock api
  31. * you can execute: mockXHR()
  32. *
  33. * Currently MockJs will be used in the production environment,
  34. * please remove it before going online ! ! !
  35. */
  36. if (process.env.NODE_ENV === 'production') {
  37. const { mockXHR } = require('../mock');
  38. mockXHR();
  39. }
  40. // set ElementUI lang to EN
  41. // Vue.use(ElementUI, { locale })
  42. // 如果想要中文版 element-ui,按如下方式声明
  43. Vue.use(ElementUI, { size: 'small', zIndex: 3000 });
  44. Vue.config.productionTip = false;
  45. // 提示
  46. Vue.prototype.$success = message.success;
  47. Vue.prototype.$error = message.error;
  48. Vue.prototype.$warning = message.warning;
  49. window.UEDITOR_CONFIG = `${process.env.VUE_APP_BASE_API}yxl-back-end/framework/oss/ueditor/ueditor-action`;
  50. window.UEDITOR_SERVER_URL = `${process.env.VUE_APP_BASE_API}yxl-back-end/framework/oss/ueditor/ueditor-action`;
  51. // window.UEDITOR_CONFIG = `https://ex.by-health.com/baby-institute-back-end/oss/ueditor/ueditor-action`;
  52. // window.UEDITOR_SERVER_URL = `https://ex.by-health.com/baby-institute-back-end/oss/ueditor/ueditor-action`;
  53. new Vue({
  54. el: '#app',
  55. router,
  56. store,
  57. render: h => h(App)
  58. });