import { createApp } from 'vue'
import '@/assets/style.css'

import Cookies from 'js-cookie'

import ElementPlus from 'element-plus'
import locale from 'element-plus/es/locale/lang/zh-cn' // 中文语言

import '@/assets/styles/index.scss' // global css
import 'form-making/dist/FormMaking.css' // 自定义表单

import 'element-plus/theme-chalk/index.css'
// svg图标
import 'virtual:svg-icons-register'
import SvgIcon from '@/components/SvgIcon'
import elementIcons from '@/components/SvgIcon/svgicon'
 

import App from './App'
import store from './store'
import router from './router'

import { download } from '@/utils/request'



// import useSelectStore from '@/store/commonSelect/common'

// 注册指令
import plugins from './plugins' // plugins

// svg图标
import 'virtual:svg-icons-register'

import './permission' // permission control
import 'default-passive-events'
import { useDict } from '@/utils/dict'
import { parseTime, resetForm, addDateRange, handleTree, selectDictLabel, selectDictLabels, getTimeDifference } from '@/utils/ruoyi'



// 自定义表单
import formCreate from '@form-create/element-ui'
import FcDesigner from '@form-create/designer'

import JssipMiao from 'miaojssip'
// jssip-miao-vue3
const app = createApp(App)
// 全局方法挂载
// 菜单页有用 
app.config.globalProperties.useDict = useDict
app.config.globalProperties.handleTree = handleTree
app.config.globalProperties.getTimeDifference = getTimeDifference
app.config.globalProperties.parseTime = parseTime
app.config.globalProperties.resetForm = resetForm
app.config.globalProperties.download = download

app.use(JssipMiao)
app.use(formCreate)
app.use(FcDesigner)
app.use(router)
app.use(store)
app.use(plugins)
app.use(elementIcons) 
app.component('svg-icon', SvgIcon)
app.config.warnHandler = () => null
// import '@/package/theme/index.scss';
// 使用element-plus 并且设置全局的大小
app.use(ElementPlus, {
  locale: locale,
  // 支持 large、default、small
  size: Cookies.get('size') || 'default'
})

app.mount('#app')
