import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import 'whatwg-fetch' // fetch ie 11
import vuetify from './plugins/vuetify'
import '@/plugins/snackbar'
import '@/plugins/confirm'
import 'core-js/stable'
import 'regenerator-runtime/runtime'
import './permission' // 路由守卫
import * as echarts from 'echarts'
import i18n from './plugins/i18n/lang'
import addToHome from './components/AddToHome'
import UnifyExport from './components/UnifyExport'
import promise from 'es6-promise'
// 引入公用scss
import '@/styles/index.scss'

// 引入自定义指令
import Directives from './directives/index.js'
import 'scrolling-element'
// import '@babel/polyfill'
require('@babel/polyfill')

promise.polyfill()

Vue.use(Directives)

Vue.component('AddToHome', addToHome)
Vue.component('UnifyExport', UnifyExport)

Vue.config.productionTip = false
Vue.prototype.$echarts = echarts
Vue.prototype.$eventBus = new Vue()
Vue.prototype.$api = window?.g?.VUE_APP_BASE_API ?? process.env.VUE_APP_BASE_API
Vue.prototype.$previewApi = window?.g?.VUE_APP_PREVIEW_URL ?? process.env.VUE_APP_PREVIEW_URL
// 默认的标题
Vue.prototype.$DEFAULT_TITLE = '数据运营平台'

if (process.env.NODE_ENV === 'production') {
  // 重写 console.log, console.warn, console.error 等方法
  console.log = () => {}
  console.warn = () => {}
  console.error = () => {}
}

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