import Vue from 'vue'
import App from './App.vue'
import router from './routers'
import store from './store'
import echarts from 'echarts'
import './plugins/element.js'
import AxiosPlugin from './plugins/AxiosPlugin'
import './assets/iconfont/iconfont.css'
import { Message } from 'element-ui'
import AMap from "vue-amap"
import dragDialog from "@/directive/drag-dialog"
import VueAnum from 'vue-animate-number'

// 引入Viewer插件
import VueViewer, { directive as viewerDirective } from 'v-viewer';
// 引入Viewer插件的图片预览器的样式
import '@/styles/viewer.css'

VueViewer.setDefaults({
  url: "data-source",
  zIndex: 99999,
  filter(image) {
    let dataSource = image.getAttribute("data-source")

    if(dataSource!=null && dataSource.length>0){
      return true;
    }
    else{
      return false;
    }
  }
})

// 使用Viewer图片预览器
Vue.use(VueViewer)
// 用于图片预览的指令方式调用 在元素上加上会处理元素下所有的图片,为图片添加点击事件,点击即可预览
Vue.directive('viewer', viewerDirective({debug: true}));

Vue.config.productionTip = false
Vue.use(AxiosPlugin);
//Vue.use(ConfirmPlugin);
Vue.use(AMap);
Vue.use(VueAnum);

dragDialog.install(Vue);

AMap.initAMapApiLoader({
  key: "09abadb2e35fc61fd84042c518e9aebf", 
  plugin: ["AMap.Scale", "AMap.OverView", "AMap.ToolBar", "AMap.MapType"],
  uiVersion: "1.0.11", // ui库版本，不配置不加载,
  v: "1.4.4"
});

Vue.prototype.$echarts = echarts


var MY_MESSAGE_DEFAULT = {
  showClose: true
}
 
var MessageWrapper = function (options) {
  if (typeof (options) === 'object') {
    options = Object.assign({}, MY_MESSAGE_DEFAULT, options)
  }

  return Message(options)
}

for(var key in Message){
  MessageWrapper[key] = Message[key]
}

Vue.prototype.$message = MessageWrapper
new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')


