app.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import Vue from 'vue'
  2. //import axios from 'axios'
  3. import i18n from '@/locale';
  4. import router from './router/index'
  5. import store from './store'
  6. import { sync } from 'vuex-router-sync'
  7. import App from 'components/app-root'
  8. import { FontAwesomeIcon } from './icons'
  9. import iView from 'iview';
  10. import 'iview/dist/styles/iview.css';
  11. import commons from "@/utils/public.js";
  12. import apiTools from '@/api/api.js';
  13. import { fetch, post } from '@/filters/http.js';
  14. import VideoPlayer from 'vue-video-player';
  15. import jwtDecode from 'jwt-decode';
  16. require('video.js/dist/video-js.css');
  17. require('vue-video-player/src/custom-theme.css');
  18. Vue.use(VideoPlayer);
  19. import vuescroll from 'vue-scroll'
  20. import echarts from 'echarts'
  21. Vue.prototype.$api = apiTools;
  22. Vue.prototype.$post = post;
  23. Vue.prototype.$get = fetch;
  24. Vue.prototype.$eventBus = new Vue()
  25. Vue.prototype.$jwtDecode = jwtDecode;
  26. Vue.use(vuescroll)
  27. Vue.prototype.$echarts = echarts
  28. Vue.prototype.common = commons;
  29. // Registration of global components
  30. Vue.component('icon', FontAwesomeIcon);
  31. router.beforeEach((to, from, next) => {
  32. window.scroll(0, 0);
  33. next();
  34. });
  35. Vue.use(iView, {
  36. i18n: (key, value) => i18n.t(key, value)
  37. })
  38. sync(store, router)
  39. const app = new Vue({
  40. store,
  41. router,
  42. i18n,
  43. ...App
  44. })
  45. export {
  46. app,
  47. router,
  48. store
  49. }