import { createApp } from 'vue'
import Antd from 'ant-design-vue'
import App from './App'
import router from './router'
import store from './store'
import 'ant-design-vue/dist/antd.css'
import '@/vab'

import 'default-passive-events'

// 引入 ElementUI
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import zhCn from 'element-plus/lib/locale/lang/zh-cn' // 中文
import '@/assets/css/index.scss'
import '@/assets/css/global.scss'
import * as echarts from 'echarts';

import '@/icons'
import SvgIcon from "@/components/SvgIcon"

/**
 * @author chuzhixin 1204505056@qq.com
 * @description 正式环境默认使用mock，正式项目记得注释后再打包
 */
// if (process.env.NODE_ENV === 'production') {
//   const { mockXHR } = require('@/utils/static')
//   mockXHR()
// }

var app = createApp(App)

app.config.globalProperties.$echarts = echarts

app
  .component("svg-icon", SvgIcon)
  .use(store)
  .use(router)
  .use(ElementPlus, { locale: zhCn, size: 'small' })
  .use(Antd)
  .mount('#app')


/**
* @需添加路由拦截 --登录后执行
*/


router.beforeEach((to) => {
  if (to.path != '/login') {
    store.commit("publicSiteList");
    store.commit('publicDeviceList')
  }
})