import Vue from 'vue'
import App from './App.vue'
import './registerServiceWorker'
import router from './router'
import store from './store/index'
import request from '@/benyun/utils/request'
import {download} from '@/benyun/utils/request'
import Cookies from 'js-cookie'
import lodash from 'lodash'
import plugins from '@/benyun/plugins'
import directive from './directive' // directive

import '@/assets/styles/index.scss' // global css
import '@/assets/styles/benyuntech.scss' // young css

import './assets/icons' // icon
import './permission' // permission control

import Element from 'element-ui'
import './assets/styles/element-variables.scss'

// import VXETable from 'vxe-table'
import XEUtils from 'xe-utils'
import 'vxe-table/lib/style.css'
import { VXETable, Column,Table,Modal,Button,Input } from 'vxe-table'
import zhCN from 'vxe-table/lib/locale/lang/zh-CN'
 // 按需加载的方式默认是不带国际化的，自定义国际化需要自行解析占位符 '{0}'，例如：
VXETable.setup({
  i18n: (key, args) => XEUtils.toFormatString(XEUtils.get(zhCN, key), args)
})

import gmComponent from './benyun/plugins/componentRegister'

//组件注册
import productDialog from './components/productDialog/productDialog.vue'
Vue.component('productDialog', productDialog);
import productStore from './components/productStore/productStore.vue'
Vue.component('productStore', productStore);
import buyer from './components/buyer/buyer.vue'
Vue.component('by-buyer', buyer);
import productSkuModal from './components/skuModal/productModal.vue';
Vue.component('product-sku-modal', productSkuModal);
import supplierModal from './components/supplierModal/supplierModal.vue';
Vue.component('supplier-modal', supplierModal);
import warehouse from './components/warehouse/warehouse.vue';
Vue.component('warehouse', warehouse);
import warehousePosition from './components/warehousePosition/warehousePosition.vue';
Vue.component('warehousePosition', warehousePosition);
import byLog from './components/byLog/byLog.vue';
Vue.component('byLog', byLog);
import userModal from './components/userModal/userModal.vue';
Vue.component('user-modal', userModal);

Vue.use(Element, {
  size: Cookies.get('size') || 'medium' // set element-ui default size
})

Vue.use(Column).use(Table).use(Modal).use(Button).use(Input);
Vue.use(gmComponent);
Vue.use(plugins);
Vue.use(directive);

Vue.config.productionTip = false

// 全局方法挂载
Vue.prototype.$request = request;
Vue.prototype.$lodash = lodash;
Vue.prototype.$download = download; //下载
Vue.prototype.$XModal = VXETable.modal


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