main.js 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. import Vue from 'vue'
  2. import VueRouter from 'vue-router'
  3. import 'normalize.css/normalize.css' // A modern alternative to CSS resets
  4. import ElementUI from 'element-ui'
  5. import 'element-ui/lib/theme-chalk/index.css'
  6. import UmyUi from 'umy-ui'
  7. import 'umy-ui/lib/theme-chalk/index.css';// 引入样式
  8. // const ElementUI = require('element-ui')
  9. // require('element-ui/lib/theme-chalk/index.css')
  10. // import locale from 'element-ui/lib/locale/lang/zh-CN' // lang i18n
  11. import locale from 'element-ui/lib/locale/lang/en' // lang i18n
  12. import iconfont from './assets/iconfont/iconfont.css'
  13. import '@/styles/index.scss' // global css
  14. import * as Sentry from '@sentry/browser'
  15. import {
  16. Vue as VueIntegration
  17. } from '@sentry/integrations'
  18. import App from './App'
  19. import store from './store'
  20. import router from './router'
  21. import i18n from './i18n'
  22. import '@/icons' // icon
  23. import '@/permission' // permission control
  24. import './icons'
  25. import * as filters from './filters' // global filters
  26. import Leaflet from 'leaflet'
  27. import "leaflet/dist/leaflet.css"
  28. Vue.use(Leaflet);
  29. Vue.config.productionTip = false
  30. /**
  31. * If you don't want to use mock-server
  32. * you want to use MockJs for mock api
  33. * you can execute: mockXHR()
  34. *
  35. * Currently MockJs will be used in the production environment,
  36. * please remove it before going online! ! !
  37. */
  38. // import { mockXHR } from '../mock'
  39. if (process.env.NODE_ENV === 'production') {
  40. // mockXHR()
  41. }
  42. var pageCount = 50
  43. // console.log(process.env)
  44. if (process.env.NODE_ENV !== 'development') {
  45. Sentry.init({
  46. release: 'vislib@' + process.env.npm_package_version,
  47. // dsn: 'https://9d8ee0ea1a2749949dd1e641b0f7c071@o286322.ingest.sentry.io/5217806',
  48. integrations: [new VueIntegration({
  49. Vue,
  50. attachProps: true
  51. })]
  52. })
  53. }
  54. // store.commit('app/SET_LANG', 'CN')
  55. Vue.use(VueRouter)
  56. Vue.use(pageCount)
  57. Vue.use(ElementUI, {
  58. i18n: (key, value) => i18n.t(key, value)
  59. })
  60. Vue.use(UmyUi);
  61. // register global utility filters
  62. Object.keys(filters).forEach(key => {
  63. Vue.filter(key, filters[key])
  64. })
  65. import echarts from 'echarts'
  66. Vue.use(echarts)
  67. // Vue.prototype.$echarts = echarts
  68. new Vue({
  69. el: '#app',
  70. router,
  71. store,
  72. i18n,
  73. render: h => h(App)
  74. })
  75. Vue.directive('loadmore', {
  76. bind(el, binding) {
  77. const selectWrap = el.querySelector('.el-table__body-wrapper')
  78. selectWrap.addEventListener('scroll', function() {
  79. let sign = 0
  80. const scrollDistance = this.scrollHeight - this.scrollTop - this.clientHeight
  81. if (scrollDistance <= sign) {
  82. binding.value()
  83. }
  84. })
  85. }
  86. })