app.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. import Vue from 'vue'
  2. import i18n from '@/locale';
  3. import router from './router/index'
  4. import store from './store'
  5. import { sync } from 'vuex-router-sync'
  6. import App from 'components/app-root'
  7. import { FontAwesomeIcon } from './icons'
  8. import iView from 'iview';
  9. import 'iview/dist/styles/iview.css';
  10. import commons from "@/utils/public.js";
  11. import apiTools from '@/api/api.js';
  12. import { fetch, post } from '@/filters/http.js';
  13. import VideoPlayer from 'vue-video-player';
  14. import jwtDecode from 'jwt-decode';
  15. require('video.js/dist/video-js.css');
  16. require('vue-video-player/src/custom-theme.css');
  17. Vue.use(VideoPlayer);
  18. //新添加的
  19. import vuescroll from 'vue-scroll'
  20. import echarts from 'echarts'
  21. //全局API请求
  22. Vue.prototype.$api = apiTools;
  23. Vue.prototype.$post = post;
  24. Vue.prototype.$get = fetch;
  25. Vue.prototype.$jwtDecode = jwtDecode;
  26. Vue.use(vuescroll)
  27. Vue.prototype.$echarts = echarts
  28. //ZXJ
  29. Vue.prototype.common = commons;
  30. // Registration of global components
  31. Vue.component('icon', FontAwesomeIcon);
  32. //使用钩子函数对路由进行权限跳转
  33. //router.beforeEach((to, from, next) => {
  34. //const role = localStorage.getItem('token');
  35. // if (!role && to.path !== '/') {
  36. // next('/');
  37. // } else {
  38. // next();
  39. // }
  40. //})
  41. //Vue.prototype.$http = axios
  42. Vue.use(iView, {
  43. i18n: (key, value) => i18n.t(key, value)
  44. })
  45. sync(store, router)
  46. const app = new Vue({
  47. store,
  48. router,
  49. i18n,
  50. ...App
  51. })
  52. export {
  53. app,
  54. router,
  55. store
  56. }