main.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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:8888';
  27. // axios.defaults.baseURL = 'http://132.232.92.186:8888';
  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. // 兼容性导入方式
  59. let marked
  60. try {
  61. // 尝试作为命名导入(marked 4.x+)
  62. const markedModule = require('marked')
  63. marked = markedModule.marked || markedModule.default || markedModule
  64. } catch (error) {
  65. console.error('marked 导入失败:', error)
  66. }
  67. // 如果导入成功,进行配置
  68. if (marked && typeof marked === 'function') {
  69. marked.setOptions({
  70. breaks: true,
  71. gfm: true,
  72. sanitize: false
  73. })
  74. Vue.prototype.$marked = marked
  75. } else {
  76. console.warn('marked 未正确加载,相关功能将不可用')
  77. }
  78. /* eslint-disable no-new */
  79. new Vue({
  80. el: '#app',
  81. router,
  82. store,
  83. components: { App },
  84. template: '<App/>'
  85. })
  86. // import htmlToPdf from './store/htmlToPdf.js';
  87. // import htmlToPdf from './store/htmlToPdf.js';
  88. // Vue.config.productionTip = false;
  89. // Vue.use(htmlToPdf);
  90. // new Vue({
  91. // render: (h) => h(App),
  92. // }).$mount('#app');