// import Vue from 'vue'
import { createApp } from 'vue'
import 'element-plus/dist/index.css'
import ElementPlus from 'element-plus'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
// 引入gin-vue-admin前端初始化相关内容
import './core/gin-vue-admin'
// 引入封装的router
import router from '@/router/index'
import { run } from '@/core/gin-vue-admin.js'
import '@/permission'
import { store } from '@/store/index'
// 字典标签组件
import DictTag from '@/components/DictTag/index.vue'
import { auth } from '@/directive/auth'
import App from './App.vue'

import { QuillEditor } from '@vueup/vue-quill'
import '@vueup/vue-quill/dist/vue-quill.snow.css';


const app = createApp(App)
import { findSysDictionary as getDicts } from '@/api/sysDictionary'
import DataDict from '@/utils/dict'

// 字典数据组件

// Vue.prototype.getDicts = getDicts
//

run(app)
auth(app)
app.config.productionTip = false
app.config.globalProperties.$getDicts = getDicts
app.component('DictTag', DictTag)
app.component('QuillEditor', QuillEditor)
app.use(DataDict, {
  metas: {
    '*': {
      labelField: 'label',
      valueField: 'value',
      request(dictMeta) {
        return getDicts({ type: dictMeta.type }).then(res => res.data)
      },
    },
  },
})
app.use(store).use(router).use(ElementPlus, { locale: zhCn }).mount('#app')

export default app
