// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import Cesium from 'cesium/Cesium' // webpack.base.conf中指定的别名alias
import 'cesium/Widgets/widgets.css'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import './assets/css/common.scss'
import './assets/css/button.css'

// gll
import VueRouter from 'vue-router'
import {
  store
} from './components/vuex/store'
import './icons'
import VueJsonp from 'vue-jsonp'
import './directives.js'

Vue.use(ElementUI)
Vue.use(VueJsonp)

// gll
Vue.use(VueRouter)

Vue.prototype.Cesium = Cesium
window.Cesium = Cesium // expose Cesium to the OL-Cesium library

Vue.config.productionTip = false

Vue.prototype.openLoading = function () {
  const loading = this.$loading({ // 声明一个loading对象
    lock: true, // 是否锁屏
    text: '正在加载中...', // 加载动画的文字
    background: '#fff', // 背景颜色
    target: '.sub-main', // 需要遮罩的区域
    body: true,
    customClass: 'mask' // 遮罩层新增类名
  })
  setTimeout(function () { // 设定定时器，超时5S后自动关闭遮罩层，避免请求失败时，遮罩层一直存在的问题
    loading.close() // 关闭遮罩层
  }, 50)
  return loading
}
/* eslint-disable no-new */
new Vue({
  store: store,
  el: '#app',
  router,
  components: {
    App
  },
  template: '<App/>'
})
