main.js 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. import Vue from 'vue'
  2. import VueRouter from 'vue-router'
  3. import Cookies from 'js-cookie'
  4. import Element from 'element-ui'
  5. import './assets/styles/element/element-variables.scss'
  6. import '@/assets/styles/index.scss'
  7. import '@/utils/browser_patch'
  8. import App from './App'
  9. import store from './store'
  10. import router from './router'
  11. import { parseTime,judgmentNetworkReturnAddress,accAdd,accSub,accDiv,accMul } from "@/utils/index";
  12. //全屏组件
  13. import dataV from '@jiaminghi/data-view'
  14. import './assets/icons'
  15. import Pagination from "@/components/Pagination";
  16. // 引入echarts
  17. import * as echarts from 'echarts'
  18. import "echarts-gl";
  19. Vue.prototype.$echarts = echarts
  20. Vue.prototype.parseTime = parseTime
  21. Vue.prototype.judgmentNetworkReturnAddress = judgmentNetworkReturnAddress
  22. Vue.prototype.accAdd = accAdd
  23. Vue.prototype.accSub = accSub
  24. Vue.prototype.accDiv = accDiv
  25. Vue.prototype.accMul = accMul
  26. Vue.component('Pagination', Pagination)
  27. Vue.prototype.msgSuccess = function (msg) {
  28. this.$message({ showClose: true, message: msg, type: "success", offset:100 });
  29. }
  30. Vue.prototype.msgError = function (msg) {
  31. this.$message({ showClose: true, message: msg, type: "error", offset:100 });
  32. }
  33. Vue.prototype.msgInfo = function (msg) {
  34. this.$message.info(msg);
  35. }
  36. //全屏组件
  37. Vue.use(dataV)
  38. /**
  39. * If you don't want to use mock-server
  40. * you want to use MockJs for mock api
  41. * you can execute: mockXHR()
  42. *
  43. * Currently MockJs will be used in the production environment,
  44. * please remove it before going online! ! !
  45. */
  46. Vue.use(Element, {
  47. size: Cookies.get('size') || 'medium' // set element-ui default size
  48. })
  49. Vue.config.productionTip = false
  50. // 避免路由冗余导航
  51. const originalPush = VueRouter.prototype.push
  52. VueRouter.prototype.push = function push(location) {
  53. return originalPush.call(this, location).catch(err => err)
  54. }
  55. const originalReplace = VueRouter.prototype.replace
  56. VueRouter.prototype.replace = function replace(location) {
  57. return originalReplace.call(this, location).catch(err => err)
  58. }
  59. new Vue({
  60. el: '#app',
  61. router,
  62. store,
  63. render: h => h(App)
  64. })