app.js 1.6 KB

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