林致杰
2023-05-01 ba3091c2e072d728344bc04db8adb1b5dece2bf0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import Vue from 'vue'
import App from './App.vue'
import { router } from './router'
import store from './store'
import 'normalize.css/normalize.css'
import Element from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import '@/assets/custom-theme/indexExtend.css'
 
import Cookies from 'js-cookie'
import i18n from './lang'
 
import '@/styles/index.scss' // global css
import './icons' // icon
import NProgress from 'nprogress' // progress bar
import 'nprogress/nprogress.css' // progress bar style
 
import 'babel-polyfill'
import promise from 'es6-promise'
 
import * as echarts from 'echarts'
Vue.prototype.$echarts = echarts
 
promise.polyfill()
 
Vue.use(Element, {
  size: Cookies.get('size') || 'medium', // set element-ui default size
  i18n: (key, value) => i18n.t(key, value)
})
 
Vue.config.productionTip = false
 
NProgress.configure({ showSpinner: false }) // NProgress Configuration
 
router.beforeEach(async (to, from, next) => {
  // start progress bar
  NProgress.start()
  if (to.meta.title !== undefined) {
    document.title = to.meta.title
  } else {
    document.title = '\u200E'
  }
 
  if (to.meta.bodyBackground !== undefined) {
    document.querySelector('body').setAttribute('style', 'background: ' + to.meta.bodyBackground)
  } else {
    document.querySelector('body').removeAttribute('style')
  }
 
  if (to.path) {
    // eslint-disable-next-line no-undef
    _hmt.push(['_trackPageview', '/#' + to.fullPath])
  }
  next()
})
 
router.afterEach((to, from, next) => {
  // finish progress bar
  NProgress.done()
})
 
Vue.prototype.$$router = router
 
new Vue({
  router: router,
  store: store,
  i18n,
  render: h => h(App)
}).$mount('#app')