import Vue from 'vue'

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


// import enLang from 'element-ui/lib/locale/lang/cn'// 如果使用中文语言包请默认支持，无需额外引入，请删除该依赖
import ElementUI from 'element-ui'
import './styles/element-variables.scss'
import './styles/index.scss' // global css
import 'normalize.css/normalize.css' // a modern alternative to CSS resets

import './icons' // icon
import './permission' // permission control
import './utils/error-log' // error log
import Bus from '@/utils/bus.js'
// import 'lib-flexible/flexible'
Vue.use(ElementUI);
Vue.component(ElementUI.Message)

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



// Vue.use(Element, {
//   size: Cookies.get('size') || 'medium', // set element-ui default size
//   locale: enLang // 如果使用中文，无需设置，请删除
// })

Vue.use(Bus)


Vue.prototype.$message.successMsg = function (msg, duration=2) {
    return ElementUI.Message.success({
        message: msg,
        duration: duration*1000
    })
}

Vue.prototype.$message.errorMsg = function (msg, duration=2) {
    return ElementUI.Message.error({
        message: msg,
        duration:duration*1000
    })
}

// 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)
})
