import {createApp} from 'vue'
import App from './App.vue'
//ElementPlus
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
// TDesign
import TDesign from 'tdesign-vue-next'
// 引入组件库的少量全局样式变量
import 'tdesign-vue-next/es/style/index.css'
// pinia
import {createPinia} from 'pinia'
//router
import router from './router/index.js'
//crud
import curdVue3 from './utils/curdVue3'
// el-icon
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import zhCn from 'element-plus/es/locale/lang/zh-cn'

const app = createApp(App)
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
}
// 提供全局方法


app.use(ElementPlus, {
    locale: zhCn,
})

app.use(TDesign)
const pinia = createPinia() // 创建 Pinia 实例
app.use(pinia)
app.use(curdVue3)
app.use(router)

app.provide('CreateData', app.config.globalProperties.CreateData)
app.provide('ExecDatabase', app.config.globalProperties.ExecDatabase)
app.provide('ExecDatabaseByParam', app.config.globalProperties.ExecDatabaseByParam)
app.provide('ExecWritePLC', app.config.globalProperties.ExecWritePLC)
app.provide('ExecReadPLC', app.config.globalProperties.ExecReadPLC)
app.provide('ExecMultReadPLC', app.config.globalProperties.ExecMultReadPLC)
app.provide('ExecIMESAPI', app.config.globalProperties.ExecIMESAPI)

app.mount('#app')

// useRouteGuard(); // 使用路由守卫

