import Vue from 'vue'

import Cookies from 'js-cookie'

import 'normalize.css/normalize.css'
import './styles/datastyle.css'

import Element from 'element-ui'

// 数据字典
import dict from './components/Dict'

// 权限指令
import checkPer from '@/utils/permission'
import permission from './components/Permission'
import './assets/styles/element-variables.scss'

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

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

import './assets/icons' // icon
import './router/index' // permission control
import './utils/error-log' // error log

import * as filters from './filters' // global filters
import echarts from 'echarts'

import { getDicts } from '@/api/systemMarket/dict'
import { getConfigKey } from '@/api/systemMarket/config'
import { selectDictLabel } from '@/utils/data-process'

Vue.prototype.getDicts = getDicts
Vue.prototype.getConfigKey = getConfigKey
Vue.prototype.selectDictLabel = selectDictLabel

Vue.prototype.$echarts = echarts

Vue.use(checkPer)
Vue.use(permission)
Vue.use(dict)
Vue.use(Element, {
  size: Cookies.get('size') || 'small' // set element-ui default size
})

// register global utility filters
Object.keys(filters).forEach(key => {
  Vue.filter(key, filters[key])
})

Vue.config.productionTip = false

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