import 'babel-polyfill';
import 'classlist-polyfill';
import Vue from 'vue';

import VueAxios from 'vue-axios';
import App from './App';
import './permission'; // 权限
import './error'; // 日志
import router from './router/router';
import store from './store';
import { loadStyle } from './util/util';
import * as urls from '@/config/env';
import { iconfontUrl, iconfontVersion } from '@/config/env';
import * as filters from './filters'; // 全局filter
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import axios from './router/axios';
import './styles/common.scss';
import AvueFormDesign from 'pig-avue-form-design';
import basicContainer from './components/basic-container/main';
import ViewUI from 'view-design'; //iview
import 'view-design/dist/styles/iview.css'; //iview
import VXETable from 'vxe-table';
import 'vxe-table/lib/style.css';
import AvueUeditor from 'avue-plugin-ueditor';
import VueCropper from 'vue-cropper';
import AvueMap from 'avue-plugin-map';
import Enum from 'vue-enum';
import enumInfo from '@/const/constants';
import Avue from '@smallwei/avue';
import '@smallwei/avue/lib/index.css';

Vue.use(ElementUI, {
  size: 'small',
  menuType: 'text'
});

Vue.use(Enum, { enumInfo });
// 插件 json 展示
Vue.use(router);

Vue.use(Avue);
Vue.use(AvueFormDesign);

Vue.use(VueAxios, axios);
Vue.use(AvueUeditor);
Vue.use(VueCropper);
Vue.use(AvueMap);

Vue.use(ViewUI); //iview

Vue.use(VXETable);

Vue.use(window.AVUE, {
  size: 'small',
  menuType: 'text'
});

// 注册全局容器
Vue.component('basicContainer', basicContainer);

// 加载相关url地址
Object.keys(urls).forEach((key) => {
  Vue.prototype[key] = urls[key];
});

// 加载过滤器
Object.keys(filters).forEach((key) => {
  Vue.filter(key, filters[key]);
});

// 动态加载阿里云字体库
iconfontVersion.forEach((ele) => {
  loadStyle(iconfontUrl.replace('$key', ele));
});

Vue.config.productionTip = false;

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