import {createApp} from 'vue';
import App from './App.vue';

// 引入Element Plus
import ElementPlus from 'element-plus';
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import 'element-plus/dist/index.css';
// 引入自定义样式文件
 

import * as echarts from 'echarts';
window.echarts = echarts //挂载到window上

// 引入Vue-Router
import Router from './router';

// 引入Axios
import axios from 'axios';

import * as ELIcons from '@element-plus/icons-vue'


// Supermap拖拽组件
// import webgl3d_mc from "@supermap/iclient3d-vue-for-webgl/lib/index_basis.js"  //先引入
// window.webgl3d_mc = webgl3d_mc;  //便于全局调用

// main中引入语法高亮配置
// import Highlight from './utils/highlight'
// Vue.use(Highlight) 
// 引入组件库
import s from "../src/third-party/components/components.js"


axios.defaults.baseURL = "https://127.0.0.1";

const app = createApp(App);


for (let iconName in ELIcons) {
  app.component(iconName, ELIcons[iconName])
}

app.use(Router);
app.use(ElementPlus,{
  locale:zhCn
});

app.use(s);
app.mount('#app');
/**
 * 将axios挂载为app的全局自定义属性后，每个组件可以通过this直接访问到全局挂载的自定义属性
 * e.g. this.$http.get('/login');
 * ===================================
 * 如果使用组合式API【setup()语法】，由于vue3.0没有this，需要使用getCurrentInstance来获取上下文
 * e.g.
 * const { proxy } = getCurrentInstance()
 proxy.$http.get('api/getNewsList')
 .then((response)=>{
       console.log(response)
   });
 */
app.config.globalProperties.$http = axios;