main.js 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. // The Vue build version to load with the `import` command
  2. // (runtime-only or standalone) has been set in webpack.base.conf with an alias.
  3. import Vue from 'vue'
  4. import App from './App'
  5. import router from './router'
  6. import ElementUI from 'element-ui';
  7. import 'element-ui/lib/theme-chalk/index.css';
  8. import './assets/icon/iconfont.css'
  9. import store from './store/index.js';
  10. import VueTypedJs from 'vue-typed-js'
  11. //富文本
  12. import VueQuillEditor from 'vue-quill-editor'
  13. import 'quill/dist/quill.core.css'
  14. import 'quill/dist/quill.snow.css'
  15. import 'quill/dist/quill.bubble.css'
  16. Vue.use(VueQuillEditor);
  17. // import CKEditor from '@ckeditor/ckeditor5-vue2'
  18. // Vue.use( CKEditor );
  19. import * as echarts from 'echarts';
  20. Vue.use(echarts);
  21. // 配置cookie
  22. import cookie from 'vue-cookie'
  23. Vue.prototype.$cookie = cookie; //配置时候prototype.$这里的名字自己定义不是固定是cookie
  24. Vue.use(VueTypedJs)
  25. import axios from 'axios';
  26. axios.defaults.baseURL = 'http://132.232.92.186:9001';
  27. // axios.defaults.baseURL = 'http://132.232.92.186:9001';
  28. //axios.defaults.baseURL = 'http://localhost:5256/';
  29. import { Message } from "element-ui";
  30. import common from './assets/js/common'//全局
  31. Vue.use(common);//全局
  32. import plugin from './plugin'//全局
  33. Vue.use(plugin);//全局
  34. import websocket from './store/websocket.js'
  35. Vue.prototype.$websocket = websocket//websocket
  36. //禁用浏览器前进后腿
  37. window.addEventListener('popstate', function() {
  38. history.pushState(null, null, document.URL)
  39. })
  40. Vue.prototype.$message = Message;
  41. Vue.prototype.$axios = axios;
  42. Vue.config.productionTip = false
  43. Vue.use(ElementUI);
  44. Vue.prototype.transformDateFormat = function (time) {
  45. var date = new Date(time);
  46. var year = date.getFullYear();
  47. /* 在日期格式中,月份是从0开始的,因此要加0
  48. * 使用三元表达式在小于10的前面加0,以达到格式统一 如 09:11:05
  49. * */
  50. var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
  51. var day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
  52. var hours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
  53. var minutes = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
  54. var seconds = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
  55. // 拼接
  56. return year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
  57. };
  58. /* eslint-disable no-new */
  59. new Vue({
  60. el: '#app',
  61. router,
  62. store,
  63. components: { App },
  64. template: '<App/>'
  65. })