import Vue from 'vue'
import Cookies from 'js-cookie'
import ElementUI from 'element-ui'
import '../assets/styles/app.css'
import '../assets/styles/layout.css'
import i18n from '../lang' // internationalization
// import directives from '../directives'
import components from '../components'
import * as filters from '../filters' // global filters
const register = function() {
  // 使用elementUI组件库
  Vue.use(ElementUI, {
    size: Cookies.get('size') || 'medium', // set element-ui default size
    i18n: (key, value) => i18n.t(key, value)
  })
  // register global utility filters
  Object.keys(filters).forEach(key => {
    Vue.filter(key, filters[key])
  })
  // Object.keys(directives).forEach(key => Vue.directive(key, directive[key]))
  // 注册组件
  Object.keys(components).forEach(e => Vue.component(e, components[e]))
}
// const install = e => register(e)

export default {
  // install,
  register
}
