import { createApp } from 'vue'
import { createPinia } from 'pinia'
import './style.css'
import App from './App.vue'
//导入ant-design-vue框架
import Antd from 'ant-design-vue';
import 'ant-design-vue/dist/reset.css';

// 导入element-plus框架
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import locale from 'element-plus/es/locale/lang/zh-cn'
//Cookies插件
import Cookies from 'js-cookie'
//引入公共样式
import '@/static/scss/index.scss' // global css
import '@/static/css/index.css'
import '@/static/elementPlus/element-plus.scss'

import store from './store/index.js'
import router from './router/index.js'
import SvgIcon from '@/components/SvgIcon/index.vue' //
import elementIcons from '@/components/SvgIcon/svgicon.js'
import VxeUIAll from 'vxe-pc-ui'
import 'vxe-pc-ui/es/style.css'
import VxeUITable from 'vxe-table'
import 'vxe-table/es/style.css'

import './permission' // 路由拦截和加载页面进度条
// 全局配置组件
// 文件上传组件
import FileUpload from "@/components/FileUpload/index.vue"
// 图片上传组件
import ImageUpload from "@/components/ImageUpload/index.vue"
// 图片预览组件
import ImagePreview from "@/components/ImagePreview/index.vue"
// import VueCropper from 'vue-cropper'//用户头像裁剪

import { useDict } from '@/utils/dict'

import directive from './directive' // 导入公共函数

const app = createApp(App)
const pinia = createPinia();
// 全局方法挂载
app.config.globalProperties.useDict = useDict
localStorage.setItem('lastValidMenuPath','/home')


// 全局组件挂载
app.component('FileUpload', FileUpload)
app.component('ImageUpload', ImageUpload)
app.component('ImagePreview', ImagePreview)


app.use(router)
app.use(store)
app.use(elementIcons)
// app.use(VueCropper)
app.component('svg-icon', SvgIcon)

directive(app)//挂载全局函数
app.use(Antd)
app.use(pinia)
// 使用element-plus 并且设置全局的大小
app.use(ElementPlus, {
  locale: locale,
  // 支持 large、default、small
  size: Cookies.get('size') || 'default'
})

app.use(VxeUIAll).use(VxeUITable)

app.mount('#app')
