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 locale from 'element-ui/lib/locale/lang/en' // lang i18n

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

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

import '@/icons' // icon
import '@/permission' // permission control

import 'babel-polyfill'

// Vue.use(ElementUI, { locale })
Vue.use(ElementUI)

Vue.config.productionTip = false

// 工具类
// import axios from './utils/axios'
// Vue.$axios = Vue.prototype.$axios = axios

// 自定义指令
import dateformat from './directives/dateformat'
Vue.directive('dateformat', dateformat)

import bus from './utils/bus'
Vue.$bus = Vue.prototype.$bus = bus

import region from '@/api/region'
new Vue({
    el: '#app',
    router,
    store,
    data() {
        return {
            regionOptions: []
        }
    },
    created() {

    },
    methods: {
        getRegion() {
            region.getRegionList().then(res => {
                // console.log(res)
                this.regionOptions = [{ name: '全部', id: '' }]
                this.regionOptions = this.regionOptions.concat(res.results.resultList)
            }).catch(err => {
                console.log(err)
            })
        }
    },
    render: h => h(App)
})
