app.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. //新添加的
  20. import vuescroll from 'vue-scroll'
  21. import echarts from 'echarts'
  22. //全局API请求
  23. Vue.prototype.$api = apiTools;
  24. Vue.prototype.$post = post;
  25. Vue.prototype.$get = fetch;
  26. Vue.prototype.$eventBus = new Vue()
  27. Vue.prototype.$jwtDecode = jwtDecode;
  28. Vue.use(vuescroll)
  29. Vue.prototype.$echarts = echarts
  30. //ZXJ
  31. Vue.prototype.common = commons;
  32. // Registration of global components
  33. Vue.component('icon', FontAwesomeIcon);
  34. //使用钩子函数对路由进行权限跳转
  35. //router.beforeEach((to, from, next) => {
  36. //const role = localStorage.getItem('token');
  37. // if (!role && to.path !== '/') {
  38. // next('/');
  39. // } else {
  40. // next();
  41. // }
  42. //})
  43. //Vue.prototype.$http = axios
  44. Vue.use(iView, {
  45. i18n: (key, value) => i18n.t(key, value)
  46. })
  47. sync(store, router)
  48. const app = new Vue({
  49. store,
  50. router,
  51. i18n,
  52. ...App
  53. })
  54. export {
  55. app,
  56. router,
  57. store
  58. }