import Vue from 'vue'

import 'normalize.css/normalize.css' // A modern alternative to CSS resets

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'

import '@/styles/index.scss' // global css

import App from './App'
import store from './store'
import router from './router'

import '@/icons' // icon
import '@/permission' // permission control
import VideoPlayer from 'vue-video-player'


import {
  getFullUrl
} from '@/utils/index'

import * as echarts from 'echarts';

Vue.use(VideoPlayer)
Vue.prototype.$getFullUrl = getFullUrl
Vue.prototype.$echarts = echarts

Vue.use(ElementUI)

Vue.config.productionTip = false


// 自定义指令，防止用户多次提交，点击一次后禁用，持续两秒
Vue.directive('preventReClick', {
  inserted(el, binding) {
    el.addEventListener('click', () => {
      if (!el.disabled) {
        el.disabled = true
        setTimeout(() => {
          el.disabled = false
        }, binding.value || 2000)
      }
    })
  }
});


new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})
